(function(f) {
if (typeof exports === "object" && typeof module !== "undefined") {
module.exports = f()
} else if (typeof define === "function" && define.amd) {
define([], f)
} else {
var g;
if (typeof window !== "undefined") {
g = window
} else if (typeof global !== "undefined") {
g = global
} else if (typeof self !== "undefined") {
g = self
} else {
g = this
}
g.AFRAME = f()
}
})(function() {
var define, module, exports;
return (function() {
function r(e, n, t) {
function o(i, f) {
if (!n[i]) {
if (!e[i]) {
var c = "function" == typeof require && require;
if (!f && c) return c(i, !0);
if (u) return u(i, !0);
var a = new Error("Cannot find module '" + i + "'");
throw a.code = "MODULE_NOT_FOUND", a
}
var p = n[i] = {
exports: {}
};
e[i][0].call(p.exports, function(r) {
var n = e[i][1][r];
return o(n || r)
}, p, p.exports, r, e, n, t)
}
return n[i].exports
}
for (var u = "function" == typeof require && require, i = 0; i < t.length; i++) o(t[i]); return o } return r })()({ 1: [function(_dereq_, module, exports) { function anArray(r) { return r.BYTES_PER_ELEMENT && "[object ArrayBuffer]"===str.call(r.buffer) || Array.isArray(r) } var str=Object.prototype.toString; module.exports=anArray; }, {}], 2: [function(_dereq_, module, exports) { module.exports=function(e, n) { return "number"==typeof e ? e : "number"==typeof n ? n : 0 }; }, {}], 3: [function(_dereq_, module, exports) { "use strict" ; function getLens(o) { var r=o.length; if (r % 4> 0) throw new Error("Invalid string. Length must be a multiple of 4");
var e = o.indexOf("=");
return -1 === e && (e = r), [e, e === r ? 0 : 4 - e % 4]
}
function byteLength(o) {
var r = getLens(o),
e = r[0],
t = r[1];
return 3 * (e + t) / 4 - t
}
function _byteLength(o, r, e) {
return 3 * (r + e) / 4 - e
}
function toByteArray(o) {
for (var r, e = getLens(o), t = e[0], n = e[1], u = new Arr(_byteLength(o, t, n)), p = 0, a = n > 0 ? t - 4 : t, h = 0; h < a; h +=4) r=revLookup[o.charCodeAt(h)] << 18 | revLookup[o.charCodeAt(h + 1)] << 12 | revLookup[o.charCodeAt(h + 2)] << 6 | revLookup[o.charCodeAt(h + 3)], u[p++]=r>> 16 & 255, u[p++] = r >> 8 & 255, u[p++] = 255 & r;
return 2 === n && (r = revLookup[o.charCodeAt(h)] << 2 | revLookup[o.charCodeAt(h + 1)]>> 4, u[p++] = 255 & r), 1 === n && (r = revLookup[o.charCodeAt(h)] << 10 | revLookup[o.charCodeAt(h + 1)] << 4 | revLookup[o.charCodeAt(h + 2)]>> 2, u[p++] = r >> 8 & 255, u[p++] = 255 & r), u
}
function tripletToBase64(o) {
return lookup[o >> 18 & 63] + lookup[o >> 12 & 63] + lookup[o >> 6 & 63] + lookup[63 & o]
}
function encodeChunk(o, r, e) {
for (var t, n = [], u = r; u < e; u +=3) t=(o[u] << 16 & 16711680) + (o[u + 1] << 8 & 65280) + (255 & o[u + 2]), n.push(tripletToBase64(t)); return n.join("") } function fromByteArray(o) { for (var r, e=o.length, t=e % 3, n=[], u=0, p=e - t; u < p; u +=16383) n.push(encodeChunk(o, u, u + 16383> p ? p : u + 16383));
return 1 === t ? (r = o[e - 1], n.push(lookup[r >> 2] + lookup[r << 4 & 63] + "==" )) : 2===t && (r=(o[e - 2] << 8) + o[e - 1], n.push(lookup[r>> 10] + lookup[r >> 4 & 63] + lookup[r << 2 & 63] + "=" )), n.join("") } exports.byteLength=byteLength, exports.toByteArray=toByteArray, exports.fromByteArray=fromByteArray; for (var lookup=[], revLookup=[], Arr="undefined" !=typeof Uint8Array ? Uint8Array : Array, code="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" , i=0, len=code.length; i < len; ++i) lookup[i]=code[i], revLookup[code.charCodeAt(i)]=i; revLookup["-".charCodeAt(0)]=62, revLookup["_".charCodeAt(0)]=63; }, {}], 4: [function(_dereq_, module, exports) { "use strict" ; module.exports={ createLink: function(e, t) { var a=document.head || document.getElementsByTagName("head")[0], n=document.createElement("link"); n.href=e, n.rel="stylesheet" ; for (var d in t) if (t.hasOwnProperty(d)) { var r=t[d]; n.setAttribute("data-" + d, r) } a.appendChild(n) }, createStyle: function(e, t) { var a=document.head || document.getElementsByTagName("head")[0], n=document.createElement("style"); n.type="text/css" ; for (var d in t) if (t.hasOwnProperty(d)) { var r=t[d]; n.setAttribute("data-" + d, r) } n.sheet ? (n.innerHTML=e, n.sheet.cssText=e, a.appendChild(n)) : n.styleSheet ? (a.appendChild(n), n.styleSheet.cssText=e) : (n.appendChild(document.createTextNode(e)), a.appendChild(n)) } }; }, {}], 5: [function(_dereq_, module, exports) { function defaultSetTimout() { throw new Error("setTimeout has not been defined") } function defaultClearTimeout() { throw new Error("clearTimeout has not been defined") } function runTimeout(e) { if (cachedSetTimeout===setTimeout) return setTimeout(e, 0); if ((cachedSetTimeout===defaultSetTimout || !cachedSetTimeout) && setTimeout) return cachedSetTimeout=setTimeout, setTimeout(e, 0); try { return cachedSetTimeout(e, 0) } catch (t) { try { return cachedSetTimeout.call(null, e, 0) } catch (t) { return cachedSetTimeout.call(this, e, 0) } } } function runClearTimeout(e) { if (cachedClearTimeout===clearTimeout) return clearTimeout(e); if ((cachedClearTimeout===defaultClearTimeout || !cachedClearTimeout) && clearTimeout) return cachedClearTimeout=clearTimeout, clearTimeout(e); try { return cachedClearTimeout(e) } catch (t) { try { return cachedClearTimeout.call(null, e) } catch (t) { return cachedClearTimeout.call(this, e) } } } function cleanUpNextTick() { draining && currentQueue && (draining=!1, currentQueue.length ? queue=currentQueue.concat(queue) : queueIndex=-1, queue.length && drainQueue()) } function drainQueue() { if (!draining) { var e=runTimeout(cleanUpNextTick); draining=!0; for (var t=queue.length; t;) { for (currentQueue=queue, queue=[]; ++queueIndex < t;) currentQueue && currentQueue[queueIndex].run(); queueIndex=-1, t=queue.length } currentQueue=null, draining=!1, runClearTimeout(e) } } function Item(e, t) { this.fun=e, this.array=t } function noop() {} var process=module.exports={}, cachedSetTimeout, cachedClearTimeout; ! function() { try { cachedSetTimeout="function"==typeof setTimeout ? setTimeout : defaultSetTimout } catch (e) { cachedSetTimeout=defaultSetTimout } try { cachedClearTimeout="function"==typeof clearTimeout ? clearTimeout : defaultClearTimeout } catch (e) { cachedClearTimeout=defaultClearTimeout } }(); var queue=[], draining=!1, currentQueue, queueIndex=-1; process.nextTick=function(e) { var t=new Array(arguments.length - 1); if (arguments.length> 1)
for (var r = 1; r < arguments.length; r++) t[r - 1]=arguments[r]; queue.push(new Item(e, t)), 1 !==queue.length || draining || runTimeout(drainQueue) }, Item.prototype.run=function() { this.fun.apply(null, this.array) }, process.title="browser" , process.browser=!0, process.env={}, process.argv=[], process.version="" , process.versions={}, process.on=noop, process.addListener=noop, process.once=noop, process.off=noop, process.removeListener=noop, process.removeAllListeners=noop, process.emit=noop, process.prependListener=noop, process.prependOnceListener=noop, process.listeners=function(e) { return [] }, process.binding=function(e) { throw new Error("process.binding is not supported") }, process.cwd=function() { return "/" }, process.chdir=function(e) { throw new Error("process.chdir is not supported") }, process.umask=function() { return 0 }; }, {}], 6: [function(_dereq_, module, exports) { var Buffer=_dereq_("buffer").Buffer; module.exports=function(f, e) { if (Buffer.isBuffer(f) && Buffer.isBuffer(e)) { if ("function"==typeof f.equals) return f.equals(e); if (f.length !==e.length) return !1; for (var r=0; r < f.length; r++) if (f[r] !==e[r]) return !1; return !0 } }; }, { "buffer" : 7 }], 7: [function(_dereq_, module, exports) { (function(global) { "use strict" ; function typedArraySupport() { try { var t=new Uint8Array(1); return t.__proto__={ __proto__: Uint8Array.prototype, foo: function() { return 42 } }, 42===t.foo() && "function"==typeof t.subarray && 0===t.subarray(1, 1).byteLength } catch (t) { return !1 } } function kMaxLength() { return Buffer.TYPED_ARRAY_SUPPORT ? 2147483647 : 1073741823 } function createBuffer(t, e) { if (kMaxLength() < e) throw new RangeError("Invalid typed array length"); return Buffer.TYPED_ARRAY_SUPPORT ? (t=new Uint8Array(e), t.__proto__=Buffer.prototype) : (null===t && (t=new Buffer(e)), t.length=e), t } function Buffer(t, e, r) { if (!(Buffer.TYPED_ARRAY_SUPPORT || this instanceof Buffer)) return new Buffer(t, e, r); if ("number"==typeof t) { if ("string"==typeof e) throw new Error("If encoding is specified then the first argument must be a string"); return allocUnsafe(this, t) } return from(this, t, e, r) } function from(t, e, r, n) { if ("number"==typeof e) throw new TypeError('"value" argument must not be a number'); return "undefined" !=typeof ArrayBuffer && e instanceof ArrayBuffer ? fromArrayBuffer(t, e, r, n) : "string"==typeof e ? fromString(t, e, r) : fromObject(t, e) } function assertSize(t) { if ("number" !=typeof t) throw new TypeError('"size" argument must be a number'); if (t < 0) throw new RangeError('"size" argument must not be negative') } function alloc(t, e, r, n) { return assertSize(e), e <=0 ? createBuffer(t, e) : void 0 !==r ? "string"==typeof n ? createBuffer(t, e).fill(r, n) : createBuffer(t, e).fill(r) : createBuffer(t, e) } function allocUnsafe(t, e) { if (assertSize(e), t=createBuffer(t, e < 0 ? 0 : 0 | checked(e)), !Buffer.TYPED_ARRAY_SUPPORT) for (var r=0; r < e; ++r) t[r]=0; return t } function fromString(t, e, r) { if ("string"==typeof r && "" !==r || (r="utf8" ), !Buffer.isEncoding(r)) throw new TypeError('"encoding" must be a valid string encoding'); var n=0 | byteLength(e, r); t=createBuffer(t, n); var f=t.write(e, r); return f !==n && (t=t.slice(0, f)), t } function fromArrayLike(t, e) { var r=e.length < 0 ? 0 : 0 | checked(e.length); t=createBuffer(t, r); for (var n=0; n < r; n +=1) t[n]=255 & e[n]; return t } function fromArrayBuffer(t, e, r, n) { if (e.byteLength, r < 0 || e.byteLength < r) throw new RangeError("'offset' is out of bounds"); if (e.byteLength < r + (n || 0)) throw new RangeError("'length' is out of bounds"); return e=void 0===r && void 0===n ? new Uint8Array(e) : void 0===n ? new Uint8Array(e, r) : new Uint8Array(e, r, n), Buffer.TYPED_ARRAY_SUPPORT ? (t=e, t.__proto__=Buffer.prototype) : t=fromArrayLike(t, e), t } function fromObject(t, e) { if (Buffer.isBuffer(e)) { var r=0 | checked(e.length); return t=createBuffer(t, r), 0===t.length ? t : (e.copy(t, 0, 0, r), t) } if (e) { if ("undefined" !=typeof ArrayBuffer && e.buffer instanceof ArrayBuffer || "length" in e) return "number" !=typeof e.length || isnan(e.length) ? createBuffer(t, 0) : fromArrayLike(t, e); if ("Buffer"===e.type && isArray(e.data)) return fromArrayLike(t, e.data) } throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.") } function checked(t) { if (t>= kMaxLength()) throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + kMaxLength().toString(16) + " bytes");
return 0 | t
}
function SlowBuffer(t) {
return +t != t && (t = 0), Buffer.alloc(+t)
}
function byteLength(t, e) {
if (Buffer.isBuffer(t)) return t.length;
if ("undefined" != typeof ArrayBuffer && "function" == typeof ArrayBuffer.isView && (ArrayBuffer.isView(t) || t instanceof ArrayBuffer)) return t.byteLength;
"string" != typeof t && (t = "" + t);
var r = t.length;
if (0 === r) return 0;
for (var n = !1;;) switch (e) {
case "ascii":
case "latin1":
case "binary":
return r;
case "utf8":
case "utf-8":
case void 0:
return utf8ToBytes(t).length;
case "ucs2":
case "ucs-2":
case "utf16le":
case "utf-16le":
return 2 * r;
case "hex":
return r >>> 1;
case "base64":
return base64ToBytes(t).length;
default:
if (n) return utf8ToBytes(t).length;
e = ("" + e).toLowerCase(), n = !0
}
}
function slowToString(t, e, r) {
var n = !1;
if ((void 0 === e || e < 0) && (e=0), e> this.length) return "";
if ((void 0 === r || r > this.length) && (r = this.length), r <= 0) return "" ; if (r>>>= 0, e >>>= 0, r <= e) return "" ; for (t || (t="utf8" );;) switch (t) { case "hex" : return hexSlice(this, e, r); case "utf8" : case "utf-8" : return utf8Slice(this, e, r); case "ascii" : return asciiSlice(this, e, r); case "latin1" : case "binary" : return latin1Slice(this, e, r); case "base64" : return base64Slice(this, e, r); case "ucs2" : case "ucs-2" : case "utf16le" : case "utf-16le" : return utf16leSlice(this, e, r); default: if (n) throw new TypeError("Unknown encoding: " + t);
t = (t + "").toLowerCase(), n = !0
}
}
function swap(t, e, r) {
var n = t[e];
t[e] = t[r], t[r] = n
}
function bidirectionalIndexOf(t, e, r, n, f) {
if (0 === t.length) return -1;
if (" string"==typeof r ? (n=r, r=0) : r> 2147483647 ? r = 2147483647 : r < -2147483648 && (r=-2147483648), r=+r, isNaN(r) && (r=f ? 0 : t.length - 1), r < 0 && (r=t.length + r), r>= t.length) {
if (f) return -1;
r = t.length - 1
} else if (r < 0) { if (!f) return -1; r=0 } if ("string"==typeof e && (e=Buffer.from(e, n)), Buffer.isBuffer(e)) return 0===e.length ? -1 : arrayIndexOf(t, e, r, n, f); if ("number"==typeof e) return e &=255, Buffer.TYPED_ARRAY_SUPPORT && "function"==typeof Uint8Array.prototype.indexOf ? f ? Uint8Array.prototype.indexOf.call(t, e, r) : Uint8Array.prototype.lastIndexOf.call(t, e, r) : arrayIndexOf(t, [e], r, n, f); throw new TypeError("val must be string, number or Buffer") } function arrayIndexOf(t, e, r, n, f) { function i(t, e) { return 1===o ? t[e] : t.readUInt16BE(e * o) } var o=1, u=t.length, s=e.length; if (void 0 !==n && ("ucs2"===(n=String(n).toLowerCase()) || "ucs-2"===n || "utf16le"===n || "utf-16le"===n)) { if (t.length < 2 || e.length < 2) return -1; o=2, u /=2, s /=2, r /=2 } var a; if (f) { var h=-1; for (a=r; a < u; a++) if (i(t, a)===i(e, -1===h ? 0 : a - h)) { if (-1===h && (h=a), a - h + 1===s) return h * o } else -1 !==h && (a -=a - h), h=-1 } else for (r + s> u && (r = u - s), a = r; a >= 0; a--) {
for (var c = !0, l = 0; l < s; l++) if (i(t, a + l) !==i(e, l)) { c=!1; break } if (c) return a } return -1 } function hexWrite(t, e, r, n) { r=Number(r) || 0; var f=t.length - r; n ? (n=Number(n))> f && (n = f) : n = f;
var i = e.length;
if (i % 2 != 0) throw new TypeError("Invalid hex string");
n > i / 2 && (n = i / 2);
for (var o = 0; o < n; ++o) { var u=parseInt(e.substr(2 * o, 2), 16); if (isNaN(u)) return o; t[r + o]=u } return o } function utf8Write(t, e, r, n) { return blitBuffer(utf8ToBytes(e, t.length - r), t, r, n) } function asciiWrite(t, e, r, n) { return blitBuffer(asciiToBytes(e), t, r, n) } function latin1Write(t, e, r, n) { return asciiWrite(t, e, r, n) } function base64Write(t, e, r, n) { return blitBuffer(base64ToBytes(e), t, r, n) } function ucs2Write(t, e, r, n) { return blitBuffer(utf16leToBytes(e, t.length - r), t, r, n) } function base64Slice(t, e, r) { return 0===e && r===t.length ? base64.fromByteArray(t) : base64.fromByteArray(t.slice(e, r)) } function utf8Slice(t, e, r) { r=Math.min(t.length, r); for (var n=[], f=e; f < r;) { var i=t[f], o=null, u=i> 239 ? 4 : i > 223 ? 3 : i > 191 ? 2 : 1;
if (f + u <= r) { var s, a, h, c; switch (u) { case 1: i < 128 && (o=i); break; case 2: s=t[f + 1], 128==(192 & s) && (c=(31 & i) << 6 | 63 & s)> 127 && (o = c);
break;
case 3:
s = t[f + 1], a = t[f + 2], 128 == (192 & s) && 128 == (192 & a) && (c = (15 & i) << 12 | (63 & s) << 6 | 63 & a)> 2047 && (c < 55296 || c> 57343) && (o = c);
break;
case 4:
s = t[f + 1], a = t[f + 2], h = t[f + 3], 128 == (192 & s) && 128 == (192 & a) && 128 == (192 & h) && (c = (15 & i) << 18 | (63 & s) << 12 | (63 & a) << 6 | 63 & h)> 65535 && c < 1114112 && (o=c) } } null===o ? (o=65533, u=1) : o> 65535 && (o -= 65536, n.push(o >>> 10 & 1023 | 55296), o = 56320 | 1023 & o), n.push(o), f += u
}
return decodeCodePointsArray(n)
}
function decodeCodePointsArray(t) {
var e = t.length;
if (e <= MAX_ARGUMENTS_LENGTH) return String.fromCharCode.apply(String, t); for (var r="" , n=0; n < e;) r +=String.fromCharCode.apply(String, t.slice(n, n +=MAX_ARGUMENTS_LENGTH)); return r } function asciiSlice(t, e, r) { var n="" ; r=Math.min(t.length, r); for (var f=e; f < r; ++f) n +=String.fromCharCode(127 & t[f]); return n } function latin1Slice(t, e, r) { var n="" ; r=Math.min(t.length, r); for (var f=e; f < r; ++f) n +=String.fromCharCode(t[f]); return n } function hexSlice(t, e, r) { var n=t.length; (!e || e < 0) && (e=0), (!r || r < 0 || r> n) && (r = n);
for (var f = "", i = e; i < r; ++i) f +=toHex(t[i]); return f } function utf16leSlice(t, e, r) { for (var n=t.slice(e, r), f="" , i=0; i < n.length; i +=2) f +=String.fromCharCode(n[i] + 256 * n[i + 1]); return f } function checkOffset(t, e, r) { if (t % 1 !=0 || t < 0) throw new RangeError("offset is not uint"); if (t + e> r) throw new RangeError("Trying to access beyond buffer length")
}
function checkInt(t, e, r, n, f, i) {
if (!Buffer.isBuffer(t)) throw new TypeError('"buffer" argument must be a Buffer instance');
if (e > f || e < i) throw new RangeError('"value" argument is out of bounds'); if (r + n> t.length) throw new RangeError("Index out of range")
}
function objectWriteUInt16(t, e, r, n) {
e < 0 && (e=65535 + e + 1); for (var f=0, i=Math.min(t.length - r, 2); f < i; ++f) t[r + f]=(e & 255 << 8 * (n ? f : 1 - f))>>> 8 * (n ? f : 1 - f)
}
function objectWriteUInt32(t, e, r, n) {
e < 0 && (e=4294967295 + e + 1); for (var f=0, i=Math.min(t.length - r, 4); f < i; ++f) t[r + f]=e>>> 8 * (n ? f : 3 - f) & 255
}
function checkIEEE754(t, e, r, n, f, i) {
if (r + n > t.length) throw new RangeError("Index out of range");
if (r < 0) throw new RangeError("Index out of range") } function writeFloat(t, e, r, n, f) { return f || checkIEEE754(t, e, r, 4, 3.4028234663852886e38, -3.4028234663852886e38), ieee754.write(t, e, r, n, 23, 4), r + 4 } function writeDouble(t, e, r, n, f) { return f || checkIEEE754(t, e, r, 8, 1.7976931348623157e308, -1.7976931348623157e308), ieee754.write(t, e, r, n, 52, 8), r + 8 } function base64clean(t) { if (t=stringtrim(t).replace(INVALID_BASE64_RE, "" ), t.length < 2) return "" ; for (; t.length % 4 !=0;) t +="=" ; return t } function stringtrim(t) { return t.trim ? t.trim() : t.replace(/^\s+|\s+$/g, "" ) } function toHex(t) { return t < 16 ? "0" + t.toString(16) : t.toString(16) } function utf8ToBytes(t, e) { e=e || 1 / 0; for (var r, n=t.length, f=null, i=[], o=0; o < n; ++o) { if ((r=t.charCodeAt(o))> 55295 && r < 57344) { if (!f) { if (r> 56319) {
(e -= 3) > -1 && i.push(239, 191, 189);
continue
}
if (o + 1 === n) {
(e -= 3) > -1 && i.push(239, 191, 189);
continue
}
f = r;
continue
}
if (r < 56320) { (e -=3)> -1 && i.push(239, 191, 189), f = r;
continue
}
r = 65536 + (f - 55296 << 10 | r - 56320) } else f && (e -=3)> -1 && i.push(239, 191, 189);
if (f = null, r < 128) { if ((e -=1) < 0) break; i.push(r) } else if (r < 2048) { if ((e -=2) < 0) break; i.push(r>> 6 | 192, 63 & r | 128)
} else if (r < 65536) { if ((e -=3) < 0) break; i.push(r>> 12 | 224, r >> 6 & 63 | 128, 63 & r | 128)
} else {
if (!(r < 1114112)) throw new Error("Invalid code point"); if ((e -=4) < 0) break; i.push(r>> 18 | 240, r >> 12 & 63 | 128, r >> 6 & 63 | 128, 63 & r | 128)
}
}
return i
}
function asciiToBytes(t) {
for (var e = [], r = 0; r < t.length; ++r) e.push(255 & t.charCodeAt(r)); return e } function utf16leToBytes(t, e) { for (var r, n, f, i=[], o=0; o < t.length && !((e -=2) < 0); ++o) r=t.charCodeAt(o), n=r>> 8, f = r % 256, i.push(f), i.push(n);
return i
}
function base64ToBytes(t) {
return base64.toByteArray(base64clean(t))
}
function blitBuffer(t, e, r, n) {
for (var f = 0; f < n && !(f + r>= e.length || f >= t.length); ++f) e[f + r] = t[f];
return f
}
function isnan(t) {
return t !== t
}
var base64 = _dereq_("base64-js"),
ieee754 = _dereq_("ieee754"),
isArray = _dereq_("isarray");
exports.Buffer = Buffer, exports.SlowBuffer = SlowBuffer, exports.INSPECT_MAX_BYTES = 50, Buffer.TYPED_ARRAY_SUPPORT = void 0 !== global.TYPED_ARRAY_SUPPORT ? global.TYPED_ARRAY_SUPPORT : typedArraySupport(), exports.kMaxLength = kMaxLength(), Buffer.poolSize = 8192, Buffer._augment = function(t) {
return t.__proto__ = Buffer.prototype, t
}, Buffer.from = function(t, e, r) {
return from(null, t, e, r)
}, Buffer.TYPED_ARRAY_SUPPORT && (Buffer.prototype.__proto__ = Uint8Array.prototype, Buffer.__proto__ = Uint8Array, "undefined" != typeof Symbol && Symbol.species && Buffer[Symbol.species] === Buffer && Object.defineProperty(Buffer, Symbol.species, {
value: null,
configurable: !0
})), Buffer.alloc = function(t, e, r) {
return alloc(null, t, e, r)
}, Buffer.allocUnsafe = function(t) {
return allocUnsafe(null, t)
}, Buffer.allocUnsafeSlow = function(t) {
return allocUnsafe(null, t)
}, Buffer.isBuffer = function(t) {
return !(null == t || !t._isBuffer)
}, Buffer.compare = function(t, e) {
if (!Buffer.isBuffer(t) || !Buffer.isBuffer(e)) throw new TypeError("Arguments must be Buffers");
if (t === e) return 0;
for (var r = t.length, n = e.length, f = 0, i = Math.min(r, n); f < i; ++f) if (t[f] !==e[f]) { r=t[f], n=e[f]; break } return r < n ? -1 : n < r ? 1 : 0 }, Buffer.isEncoding=function(t) { switch (String(t).toLowerCase()) { case "hex" : case "utf8" : case "utf-8" : case "ascii" : case "latin1" : case "binary" : case "base64" : case "ucs2" : case "ucs-2" : case "utf16le" : case "utf-16le" : return !0; default: return !1 } }, Buffer.concat=function(t, e) { if (!isArray(t)) throw new TypeError('"list" argument must be an Array of Buffers'); if (0===t.length) return Buffer.alloc(0); var r; if (void 0===e) for (e=0, r=0; r < t.length; ++r) e +=t[r].length; var n=Buffer.allocUnsafe(e), f=0; for (r=0; r < t.length; ++r) { var i=t[r]; if (!Buffer.isBuffer(i)) throw new TypeError('"list" argument must be an Array of Buffers'); i.copy(n, f), f +=i.length } return n }, Buffer.byteLength=byteLength, Buffer.prototype._isBuffer=!0, Buffer.prototype.swap16=function() { var t=this.length; if (t % 2 !=0) throw new RangeError("Buffer size must be a multiple of 16-bits"); for (var e=0; e < t; e +=2) swap(this, e, e + 1); return this }, Buffer.prototype.swap32=function() { var t=this.length; if (t % 4 !=0) throw new RangeError("Buffer size must be a multiple of 32-bits"); for (var e=0; e < t; e +=4) swap(this, e, e + 3), swap(this, e + 1, e + 2); return this }, Buffer.prototype.swap64=function() { var t=this.length; if (t % 8 !=0) throw new RangeError("Buffer size must be a multiple of 64-bits"); for (var e=0; e < t; e +=8) swap(this, e, e + 7), swap(this, e + 1, e + 6), swap(this, e + 2, e + 5), swap(this, e + 3, e + 4); return this }, Buffer.prototype.toString=function() { var t=0 | this.length; return 0===t ? "" : 0===arguments.length ? utf8Slice(this, 0, t) : slowToString.apply(this, arguments) }, Buffer.prototype.equals=function(t) { if (!Buffer.isBuffer(t)) throw new TypeError("Argument must be a Buffer"); return this===t || 0===Buffer.compare(this, t) }, Buffer.prototype.inspect=function() { var t="" , e=exports.INSPECT_MAX_BYTES; return this.length> 0 && (t = this.toString("hex", 0, e).match(/.{2}/g).join(" "), this.length > e && (t += " ... ")), ""
}, Buffer.prototype.compare = function(t, e, r, n, f) {
if (!Buffer.isBuffer(t)) throw new TypeError("Argument must be a Buffer");
if (void 0 === e && (e = 0), void 0 === r && (r = t ? t.length : 0), void 0 === n && (n = 0), void 0 === f && (f = this.length), e < 0 || r> t.length || n < 0 || f> this.length) throw new RangeError("out of range index");
if (n >= f && e >= r) return 0;
if (n >= f) return -1;
if (e >= r) return 1;
if (e >>>= 0, r >>>= 0, n >>>= 0, f >>>= 0, this === t) return 0;
for (var i = f - n, o = r - e, u = Math.min(i, o), s = this.slice(n, f), a = t.slice(e, r), h = 0; h < u; ++h) if (s[h] !==a[h]) { i=s[h], o=a[h]; break } return i < o ? -1 : o < i ? 1 : 0 }, Buffer.prototype.includes=function(t, e, r) { return -1 !==this.indexOf(t, e, r) }, Buffer.prototype.indexOf=function(t, e, r) { return bidirectionalIndexOf(this, t, e, r, !0) }, Buffer.prototype.lastIndexOf=function(t, e, r) { return bidirectionalIndexOf(this, t, e, r, !1) }, Buffer.prototype.write=function(t, e, r, n) { if (void 0===e) n="utf8" , r=this.length, e=0; else if (void 0===r && "string"==typeof e) n=e, r=this.length, e=0; else { if (!isFinite(e)) throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported"); e |=0, isFinite(r) ? (r |=0, void 0===n && (n="utf8" )) : (n=r, r=void 0) } var f=this.length - e; if ((void 0===r || r> f) && (r = f), t.length > 0 && (r < 0 || e < 0) || e> this.length) throw new RangeError("Attempt to write outside buffer bounds");
n || (n = "utf8");
for (var i = !1;;) switch (n) {
case "hex":
return hexWrite(this, t, e, r);
case "utf8":
case "utf-8":
return utf8Write(this, t, e, r);
case "ascii":
return asciiWrite(this, t, e, r);
case "latin1":
case "binary":
return latin1Write(this, t, e, r);
case "base64":
return base64Write(this, t, e, r);
case "ucs2":
case "ucs-2":
case "utf16le":
case "utf-16le":
return ucs2Write(this, t, e, r);
default:
if (i) throw new TypeError("Unknown encoding: " + n);
n = ("" + n).toLowerCase(), i = !0
}
}, Buffer.prototype.toJSON = function() {
return {
type: "Buffer",
data: Array.prototype.slice.call(this._arr || this, 0)
}
};
var MAX_ARGUMENTS_LENGTH = 4096;
Buffer.prototype.slice = function(t, e) {
var r = this.length;
t = ~~t, e = void 0 === e ? r : ~~e, t < 0 ? (t +=r) < 0 && (t=0) : t> r && (t = r), e < 0 ? (e +=r) < 0 && (e=0) : e> r && (e = r), e < t && (e=t); var n; if (Buffer.TYPED_ARRAY_SUPPORT) n=this.subarray(t, e), n.__proto__=Buffer.prototype; else { var f=e - t; n=new Buffer(f, void 0); for (var i=0; i < f; ++i) n[i]=this[i + t] } return n }, Buffer.prototype.readUIntLE=function(t, e, r) { t |=0, e |=0, r || checkOffset(t, e, this.length); for (var n=this[t], f=1, i=0; ++i < e && (f *=256);) n +=this[t + i] * f; return n }, Buffer.prototype.readUIntBE=function(t, e, r) { t |=0, e |=0, r || checkOffset(t, e, this.length); for (var n=this[t + --e], f=1; e> 0 && (f *= 256);) n += this[t + --e] * f;
return n
}, Buffer.prototype.readUInt8 = function(t, e) {
return e || checkOffset(t, 1, this.length), this[t]
}, Buffer.prototype.readUInt16LE = function(t, e) {
return e || checkOffset(t, 2, this.length), this[t] | this[t + 1] << 8 }, Buffer.prototype.readUInt16BE=function(t, e) { return e || checkOffset(t, 2, this.length), this[t] << 8 | this[t + 1] }, Buffer.prototype.readUInt32LE=function(t, e) { return e || checkOffset(t, 4, this.length), (this[t] | this[t + 1] << 8 | this[t + 2] << 16) + 16777216 * this[t + 3] }, Buffer.prototype.readUInt32BE=function(t, e) { return e || checkOffset(t, 4, this.length), 16777216 * this[t] + (this[t + 1] << 16 | this[t + 2] << 8 | this[t + 3]) }, Buffer.prototype.readIntLE=function(t, e, r) { t |=0, e |=0, r || checkOffset(t, e, this.length); for (var n=this[t], f=1, i=0; ++i < e && (f *=256);) n +=this[t + i] * f; return f *=128, n>= f && (n -= Math.pow(2, 8 * e)), n
}, Buffer.prototype.readIntBE = function(t, e, r) {
t |= 0, e |= 0, r || checkOffset(t, e, this.length);
for (var n = e, f = 1, i = this[t + --n]; n > 0 && (f *= 256);) i += this[t + --n] * f;
return f *= 128, i >= f && (i -= Math.pow(2, 8 * e)), i
}, Buffer.prototype.readInt8 = function(t, e) {
return e || checkOffset(t, 1, this.length), 128 & this[t] ? -1 * (255 - this[t] + 1) : this[t]
}, Buffer.prototype.readInt16LE = function(t, e) {
e || checkOffset(t, 2, this.length);
var r = this[t] | this[t + 1] << 8; return 32768 & r ? 4294901760 | r : r }, Buffer.prototype.readInt16BE=function(t, e) { e || checkOffset(t, 2, this.length); var r=this[t + 1] | this[t] << 8; return 32768 & r ? 4294901760 | r : r }, Buffer.prototype.readInt32LE=function(t, e) { return e || checkOffset(t, 4, this.length), this[t] | this[t + 1] << 8 | this[t + 2] << 16 | this[t + 3] << 24 }, Buffer.prototype.readInt32BE=function(t, e) { return e || checkOffset(t, 4, this.length), this[t] << 24 | this[t + 1] << 16 | this[t + 2] << 8 | this[t + 3] }, Buffer.prototype.readFloatLE=function(t, e) { return e || checkOffset(t, 4, this.length), ieee754.read(this, t, !0, 23, 4) }, Buffer.prototype.readFloatBE=function(t, e) { return e || checkOffset(t, 4, this.length), ieee754.read(this, t, !1, 23, 4) }, Buffer.prototype.readDoubleLE=function(t, e) { return e || checkOffset(t, 8, this.length), ieee754.read(this, t, !0, 52, 8) }, Buffer.prototype.readDoubleBE=function(t, e) { return e || checkOffset(t, 8, this.length), ieee754.read(this, t, !1, 52, 8) }, Buffer.prototype.writeUIntLE=function(t, e, r, n) { if (t=+t, e |=0, r |=0, !n) { checkInt(this, t, e, r, Math.pow(2, 8 * r) - 1, 0) } var f=1, i=0; for (this[e]=255 & t; ++i < r && (f *=256);) this[e + i]=t / f & 255; return e + r }, Buffer.prototype.writeUIntBE=function(t, e, r, n) { if (t=+t, e |=0, r |=0, !n) { checkInt(this, t, e, r, Math.pow(2, 8 * r) - 1, 0) } var f=r - 1, i=1; for (this[e + f]=255 & t; --f>= 0 && (i *= 256);) this[e + f] = t / i & 255;
return e + r
}, Buffer.prototype.writeUInt8 = function(t, e, r) {
return t = +t, e |= 0, r || checkInt(this, t, e, 1, 255, 0), Buffer.TYPED_ARRAY_SUPPORT || (t = Math.floor(t)), this[e] = 255 & t, e + 1
}, Buffer.prototype.writeUInt16LE = function(t, e, r) {
return t = +t, e |= 0, r || checkInt(this, t, e, 2, 65535, 0), Buffer.TYPED_ARRAY_SUPPORT ? (this[e] = 255 & t, this[e + 1] = t >>> 8) : objectWriteUInt16(this, t, e, !0), e + 2
}, Buffer.prototype.writeUInt16BE = function(t, e, r) {
return t = +t, e |= 0, r || checkInt(this, t, e, 2, 65535, 0), Buffer.TYPED_ARRAY_SUPPORT ? (this[e] = t >>> 8, this[e + 1] = 255 & t) : objectWriteUInt16(this, t, e, !1), e + 2
}, Buffer.prototype.writeUInt32LE = function(t, e, r) {
return t = +t, e |= 0, r || checkInt(this, t, e, 4, 4294967295, 0), Buffer.TYPED_ARRAY_SUPPORT ? (this[e + 3] = t >>> 24, this[e + 2] = t >>> 16, this[e + 1] = t >>> 8, this[e] = 255 & t) : objectWriteUInt32(this, t, e, !0), e + 4
}, Buffer.prototype.writeUInt32BE = function(t, e, r) {
return t = +t, e |= 0, r || checkInt(this, t, e, 4, 4294967295, 0), Buffer.TYPED_ARRAY_SUPPORT ? (this[e] = t >>> 24, this[e + 1] = t >>> 16, this[e + 2] = t >>> 8, this[e + 3] = 255 & t) : objectWriteUInt32(this, t, e, !1), e + 4
}, Buffer.prototype.writeIntLE = function(t, e, r, n) {
if (t = +t, e |= 0, !n) {
var f = Math.pow(2, 8 * r - 1);
checkInt(this, t, e, r, f - 1, -f)
}
var i = 0,
o = 1,
u = 0;
for (this[e] = 255 & t; ++i < r && (o *=256);) t < 0 && 0===u && 0 !==this[e + i - 1] && (u=1), this[e + i]=(t / o>> 0) - u & 255;
return e + r
}, Buffer.prototype.writeIntBE = function(t, e, r, n) {
if (t = +t, e |= 0, !n) {
var f = Math.pow(2, 8 * r - 1);
checkInt(this, t, e, r, f - 1, -f)
}
var i = r - 1,
o = 1,
u = 0;
for (this[e + i] = 255 & t; --i >= 0 && (o *= 256);) t < 0 && 0===u && 0 !==this[e + i + 1] && (u=1), this[e + i]=(t / o>> 0) - u & 255;
return e + r
}, Buffer.prototype.writeInt8 = function(t, e, r) {
return t = +t, e |= 0, r || checkInt(this, t, e, 1, 127, -128), Buffer.TYPED_ARRAY_SUPPORT || (t = Math.floor(t)), t < 0 && (t=255 + t + 1), this[e]=255 & t, e + 1 }, Buffer.prototype.writeInt16LE=function(t, e, r) { return t=+t, e |=0, r || checkInt(this, t, e, 2, 32767, -32768), Buffer.TYPED_ARRAY_SUPPORT ? (this[e]=255 & t, this[e + 1]=t>>> 8) : objectWriteUInt16(this, t, e, !0), e + 2
}, Buffer.prototype.writeInt16BE = function(t, e, r) {
return t = +t, e |= 0, r || checkInt(this, t, e, 2, 32767, -32768), Buffer.TYPED_ARRAY_SUPPORT ? (this[e] = t >>> 8, this[e + 1] = 255 & t) : objectWriteUInt16(this, t, e, !1), e + 2
}, Buffer.prototype.writeInt32LE = function(t, e, r) {
return t = +t, e |= 0, r || checkInt(this, t, e, 4, 2147483647, -2147483648), Buffer.TYPED_ARRAY_SUPPORT ? (this[e] = 255 & t, this[e + 1] = t >>> 8, this[e + 2] = t >>> 16, this[e + 3] = t >>> 24) : objectWriteUInt32(this, t, e, !0), e + 4
}, Buffer.prototype.writeInt32BE = function(t, e, r) {
return t = +t, e |= 0, r || checkInt(this, t, e, 4, 2147483647, -2147483648), t < 0 && (t=4294967295 + t + 1), Buffer.TYPED_ARRAY_SUPPORT ? (this[e]=t>>> 24, this[e + 1] = t >>> 16, this[e + 2] = t >>> 8, this[e + 3] = 255 & t) : objectWriteUInt32(this, t, e, !1), e + 4
}, Buffer.prototype.writeFloatLE = function(t, e, r) {
return writeFloat(this, t, e, !0, r)
}, Buffer.prototype.writeFloatBE = function(t, e, r) {
return writeFloat(this, t, e, !1, r)
}, Buffer.prototype.writeDoubleLE = function(t, e, r) {
return writeDouble(this, t, e, !0, r)
}, Buffer.prototype.writeDoubleBE = function(t, e, r) {
return writeDouble(this, t, e, !1, r)
}, Buffer.prototype.copy = function(t, e, r, n) {
if (r || (r = 0), n || 0 === n || (n = this.length), e >= t.length && (e = t.length), e || (e = 0), n > 0 && n < r && (n=r), n===r) return 0; if (0===t.length || 0===this.length) return 0; if (e < 0) throw new RangeError("targetStart out of bounds"); if (r < 0 || r>= this.length) throw new RangeError("sourceStart out of bounds");
if (n < 0) throw new RangeError("sourceEnd out of bounds"); n> this.length && (n = this.length), t.length - e < n - r && (n=t.length - e + r); var f, i=n - r; if (this===t && r < e && e < n) for (f=i - 1; f>= 0; --f) t[f + e] = this[f + r];
else if (i < 1e3 || !Buffer.TYPED_ARRAY_SUPPORT) for (f=0; f < i; ++f) t[f + e]=this[f + r]; else Uint8Array.prototype.set.call(t, this.subarray(r, r + i), e); return i }, Buffer.prototype.fill=function(t, e, r, n) { if ("string"==typeof t) { if ("string"==typeof e ? (n=e, e=0, r=this.length) : "string"==typeof r && (n=r, r=this.length), 1===t.length) { var f=t.charCodeAt(0); f < 256 && (t=f) } if (void 0 !==n && "string" !=typeof n) throw new TypeError("encoding must be a string"); if ("string"==typeof n && !Buffer.isEncoding(n)) throw new TypeError("Unknown encoding: " + n)
} else " number"==typeof t && (t &=255); if (e < 0 || this.length < e || this.length < r) throw new RangeError("Out of range index"); if (r <=e) return this; e>>>= 0, r = void 0 === r ? this.length : r >>> 0, t || (t = 0);
var i;
if ("number" == typeof t)
for (i = e; i < r; ++i) this[i]=t; else { var o=Buffer.isBuffer(t) ? t : utf8ToBytes(new Buffer(t, n).toString()), u=o.length; for (i=0; i < r - e; ++i) this[i + e]=o[i % u] } return this }; var INVALID_BASE64_RE=/[^+\/0-9A-Za-z-_]/g; }).call(this, typeof global !=="undefined" ? global : typeof self !=="undefined" ? self : typeof window !=="undefined" ? window : {}) }, { "base64-js" : 3, "ieee754" : 18, "isarray" : 8 }], 8: [function(_dereq_, module, exports) { var toString={}.toString; module.exports=Array.isArray || function(r) { return "[object Array]"==toString.call(r) }; }, {}], 9: [function(_dereq_, module, exports) { ! function() { if ("undefined" !=typeof window) try { var e=new window.CustomEvent("test", { cancelable: !0 }); if (e.preventDefault(), !0 !==e.defaultPrevented) throw new Error("Could not prevent default") } catch (e) { var t=function(e, t) { var n, r; return t=t || {}, t.bubbles=!!t.bubbles, t.cancelable=!!t.cancelable, n=document.createEvent("CustomEvent"), n.initCustomEvent(e, t.bubbles, t.cancelable, t.detail), r=n.preventDefault, n.preventDefault=function() { r.call(this); try { Object.defineProperty(this, "defaultPrevented" , { get: function() { return !0 } }) } catch (e) { this.defaultPrevented=!0 } }, n }; t.prototype=window.Event.prototype, window.CustomEvent=t } }(); }, {}], 10: [function(_dereq_, module, exports) { function useColors() { return "WebkitAppearance" in document.documentElement.style || window.console && (console.firebug || console.exception && console.table) || navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10)>= 31
}
function formatArgs() {
var o = arguments,
e = this.useColors;
if (o[0] = (e ? "%c" : "") + this.namespace + (e ? " %c" : " ") + o[0] + (e ? "%c " : " "), !e) return o;
var r = "color: " + this.color;
o = [o[0], r, "color: inherit"].concat(Array.prototype.slice.call(o, 1));
var t = 0,
s = 0;
return o[0].replace(/%[a-z%]/g, function(o) {
"%%" !== o && (t++, "%c" === o && (s = t))
}), o.splice(s, 0, r), o
}
function log() {
return "object" == typeof console && console.log && Function.prototype.apply.call(console.log, console, arguments)
}
function save(o) {
try {
null == o ? exports.storage.removeItem("debug") : exports.storage.debug = o
} catch (o) {}
}
function load() {
var o;
try {
o = exports.storage.debug
} catch (o) {}
return o
}
function localstorage() {
try {
return window.localStorage
} catch (o) {}
}
exports = module.exports = _dereq_("./debug"), exports.log = log, exports.formatArgs = formatArgs, exports.save = save, exports.load = load, exports.useColors = useColors, exports.storage = "undefined" != typeof chrome && void 0 !== chrome.storage ? chrome.storage.local : localstorage(), exports.colors = ["lightseagreen", "forestgreen", "goldenrod", "dodgerblue", "darkorchid", "crimson"], exports.formatters.j = function(o) {
return JSON.stringify(o)
}, exports.enable(load());
}, {
"./debug": 11
}],
11: [function(_dereq_, module, exports) {
function selectColor() {
return exports.colors[prevColor++ % exports.colors.length]
}
function debug(e) {
function r() {}
function o() {
var e = o;
null == e.useColors && (e.useColors = exports.useColors()), null == e.color && e.useColors && (e.color = selectColor());
var r = Array.prototype.slice.call(arguments);
r[0] = exports.coerce(r[0]), "string" != typeof r[0] && (r = ["%o"].concat(r));
var s = 0;
r[0] = r[0].replace(/%([a-z%])/g, function(o, t) {
if ("%%" === o) return o;
s++;
var n = exports.formatters[t];
if ("function" == typeof n) {
var l = r[s];
o = n.call(e, l), r.splice(s, 1), s--
}
return o
}), "function" == typeof exports.formatArgs && (r = exports.formatArgs.apply(e, r)), (o.log || exports.log || console.log.bind(console)).apply(e, r)
}
r.enabled = !1, o.enabled = !0;
var s = exports.enabled(e) ? o : r;
return s.namespace = e, s
}
function enable(e) {
exports.save(e);
for (var r = (e || "").split(/[\s,]+/), o = r.length, s = 0; s < o; s++) r[s] && (e=r[s].replace(/\*/g, ".*?" ), "-"===e[0] ? exports.skips.push(new RegExp("^" + e.substr(1) + "$" )) : exports.names.push(new RegExp("^" + e + "$" ))) } function disable() { exports.enable("") } function enabled(e) { var r, o; for (r=0, o=exports.skips.length; r < o; r++) if (exports.skips[r].test(e)) return !1; for (r=0, o=exports.names.length; r < o; r++) if (exports.names[r].test(e)) return !0; return !1 } function coerce(e) { return e instanceof Error ? e.stack || e.message : e } exports=module.exports=debug, exports.coerce=coerce, exports.disable=disable, exports.enable=enable, exports.enabled=enabled, exports.names=[], exports.skips=[], exports.formatters={}; var prevColor=0; }, {}], 12: [function(_dereq_, module, exports) { "use strict" ; function toObject(r) { if (null===r || void 0===r) throw new TypeError("Sources cannot be null or undefined"); return Object(r) } function assignKey(r, e, n) { var t=e[n]; if (void 0 !==t && null !==t) { if (hasOwnProperty.call(r, n) && (void 0===r[n] || null===r[n])) throw new TypeError("Cannot convert undefined or null to object (" + n + ")" ); hasOwnProperty.call(r, n) && isObj(t) ? r[n]=assign(Object(r[n]), e[n]) : r[n]=t } } function assign(r, e) { if (r===e) return r; e=Object(e); for (var n in e) hasOwnProperty.call(e, n) && assignKey(r, e, n); if (Object.getOwnPropertySymbols) for (var t=Object.getOwnPropertySymbols(e), o=0; o < t.length; o++) propIsEnumerable.call(e, t[o]) && assignKey(r, e, t[o]); return r } var isObj=_dereq_("is-obj"), hasOwnProperty=Object.prototype.hasOwnProperty, propIsEnumerable=Object.prototype.propertyIsEnumerable; module.exports=function(r) { r=toObject(r); for (var e=1; e < arguments.length; e++) assign(r, arguments[e]); return r }; }, { "is-obj" : 23 }], 13: [function(_dereq_, module, exports) { ! function(t, r, n, a) { "use strict" ; function l(e, t) { for (var r=0, n=e.length; r < n; r++) m(e[r], t) } function i(e) { for (var t, r=0, n=e.length; r < n; r++) t=e[r], y(t, H[u(t)]) } function o(e) { return function(t) { ae(t) && (m(t, e), l(t.querySelectorAll(x), e)) } } function u(e) { var t=oe.call(e, "is" ), r=e.nodeName.toUpperCase(), n=G.call(U, t ? k + t.toUpperCase() : _ + r); return t && -1 < n && !c(r, t) ? -1 : n } function c(e, t) { return -1 < x.indexOf(e + '[is="' + t + '"]' ) } function s(e) { var t=e.currentTarget, r=e.attrChange, n=e.attrName, a=e.target; me && (!a || a===t) && t.attributeChangedCallback && "style" !==n && e.prevValue !==e.newValue && t.attributeChangedCallback(n, r===e[F] ? null : e.prevValue, r===e[I] ? null : e.newValue) } function d(e) { var t=o(e); return function(e) { g.push(t, e.target) } } function f(e) { be && (be=!1, e.currentTarget.removeEventListener(P, f)), l((e.target || r).querySelectorAll(x), e.detail===T ? T : L), ne && p() } function h(e, t) { var r=this; ue.call(r, e, t), C.call(r, { target: r }) } function v(e, t) { ee(e, t), O ? O.observe(e, de) : (pe && (e.setAttribute=h, e[w]=E(e), e.addEventListener(R, C)), e.addEventListener(D, s)), e.createdCallback && me && (e.created=!0, e.createdCallback(), e.created=!1) } function p() { for (var e, t=0, r=le.length; t < r; t++) e=le[t], Z.contains(e) || (r--, le.splice(t--, 1), m(e, T)) } function b(e) { throw new Error("A " + e + " type is already registered") } function m(e, t) { var r, n=u(e); - 1 < n && (N(e, H[n]), n=0, t !==L || e[L] ? t===T && !e[T] && (e[L]=!1, e[T]=!0, n=1) : (e[T]=!1, e[L]=!0, n=1, ne && G.call(le, e) < 0 && le.push(e)), n && (r=e[t + "Callback" ]) && r.call(e)) } if (!(a in r)) { var g, C, A, E, O, N, y, w="__" + a + (1e5 * Math.random()>> 0),
L = "attached",
T = "detached",
M = "extends",
F = "ADDITION",
V = "MODIFICATION",
I = "REMOVAL",
D = "DOMAttrModified",
P = "DOMContentLoaded",
R = "DOMSubtreeModified",
_ = "<", k="=" , q=/^[A-Z][A-Z0-9]*(?:-[A-Z0-9]+)+$/, S=["ANNOTATION-XML", "COLOR-PROFILE" , "FONT-FACE" , "FONT-FACE-SRC" , "FONT-FACE-URI" , "FONT-FACE-FORMAT" , "FONT-FACE-NAME" , "MISSING-GLYPH" ], U=[], H=[], x="" , Z=r.documentElement, G=U.indexOf || function(e) { for (var t=this.length; t-- && this[t] !==e;); return t }, j=n.prototype, z=j.hasOwnProperty, K=j.isPrototypeOf, W=n.defineProperty, X=n.getOwnPropertyDescriptor, Y=n.getOwnPropertyNames, $=n.getPrototypeOf, B=n.setPrototypeOf, J=!!n.__proto__, Q=n.create || function e(t) { return t ? (e.prototype=t, new e) : this }, ee=B || (J ? function(e, t) { return e.__proto__=t, e } : Y && X ? function() { function e(e, t) { for (var r, n=Y(t), a=0, l=n.length; a < l; a++) r=n[a], z.call(e, r) || W(e, r, X(t, r)) } return function(t, r) { do { e(t, r) } while ((r=$(r)) && !K.call(r, t)); return t } }() : function(e, t) { for (var r in t) e[r]=t[r]; return e }), te=t.MutationObserver || t.WebKitMutationObserver, re=(t.HTMLElement || t.Element || t.Node).prototype, ne=!K.call(re, Z), ae=ne ? function(e) { return 1===e.nodeType } : function(e) { return K.call(re, e) }, le=ne && [], ie=re.cloneNode, oe=re.getAttribute, ue=re.setAttribute, ce=re.removeAttribute, se=r.createElement, de=te && { attributes: !0, characterData: !0, attributeOldValue: !0 }, fe=te || function(e) { pe=!1, Z.removeEventListener(D, fe) }, he=t.requestAnimationFrame || t.webkitRequestAnimationFrame || t.mozRequestAnimationFrame || t.msRequestAnimationFrame || function(e) { setTimeout(e, 10) }, ve=!1, pe=!0, be=!0, me=!0; B || J ? (N=function(e, t) { K.call(t, e) || v(e, t) }, y=v) : (N=function(e, t) { e[w] || (e[w]=n(!0), v(e, t)) }, y=N), ne ? (pe=!1, function() { var t=X(re, "addEventListener" ), r=t.value, n=function(e) { var t=new CustomEvent(D, { bubbles: !0 }); t.attrName=e, t.prevValue=oe.call(this, e), t.newValue=null, t[I]=t.attrChange=2, ce.call(this, e), this.dispatchEvent(t) }, a=function(t, r) { var n=this.hasAttribute(t), a=n && oe.call(this, t); e=new CustomEvent(D, { bubbles: !0 }), ue.call(this, t, r), e.attrName=t, e.prevValue=n ? a : null, e.newValue=r, n ? e[V]=e.attrChange=1 : e[F]=e.attrChange=0, this.dispatchEvent(e) }, l=function(e) { var t, r=e.currentTarget, n=r[w], a=e.propertyName; n.hasOwnProperty(a) && (n=n[a], t=new CustomEvent(D, { bubbles: !0 }), t.attrName=n.name, t.prevValue=n.value || null, t.newValue=n.value=r[a] || null, null==t.prevValue ? t[F]=t.attrChange=0 : t[V]=t.attrChange=1, r.dispatchEvent(t)) }; t.value=function(e, t, i) { e===D && this.attributeChangedCallback && this.setAttribute !==a && (this[w]={ className: { name: "class" , value: this.className } }, this.setAttribute=a, this.removeAttribute=n, r.call(this, "propertychange" , l)), r.call(this, e, t, i) }, W(re, "addEventListener" , t) }()) : te || (Z.addEventListener(D, fe), Z.setAttribute(w, 1), Z.removeAttribute(w), pe && (C=function(e) { var t, r, n, a=this; if (a===e.target) { t=a[w], a[w]=r=E(a); for (n in r) { if (!(n in t)) return A(0, a, n, t[n], r[n], F); if (r[n] !==t[n]) return A(1, a, n, t[n], r[n], V) } for (n in t) if (!(n in r)) return A(2, a, n, t[n], r[n], I) } }, A=function(e, t, r, n, a, l) { var i={ attrChange: e, currentTarget: t, attrName: r, prevValue: n, newValue: a }; i[l]=e, s(i) }, E=function(e) { for (var t, r, n={}, a=e.attributes, l=0, i=a.length; l < i; l++) t=a[l], "setAttribute" !==(r=t.name) && (n[r]=t.value); return n })), r[a]=function(e, t) { if (n=e.toUpperCase(), ve || (ve=!0, te ? (O=function(e, t) { function r(e, t) { for (var r=0, n=e.length; r < n; t(e[r++])); } return new te(function(n) { for (var a, l, i, o=0, u=n.length; o < u; o++) a=n[o], "childList"===a.type ? (r(a.addedNodes, e), r(a.removedNodes, t)) : (l=a.target, me && l.attributeChangedCallback && "style" !==a.attributeName && (i=oe.call(l, a.attributeName)) !==a.oldValue && l.attributeChangedCallback(a.attributeName, a.oldValue, i)) }) }(o(L), o(T)), O.observe(r, { childList: !0, subtree: !0 })) : (g=[], he(function e() { for (; g.length;) g.shift().call(null, g.shift()); he(e) }), r.addEventListener("DOMNodeInserted", d(L)), r.addEventListener("DOMNodeRemoved", d(T))), r.addEventListener(P, f), r.addEventListener("readystatechange", f), r.createElement=function(e, t) { var n=se.apply(r, arguments), a="" + e, l=G.call(U, (t ? k : _) + (t || a).toUpperCase()), i=-1 < l; return t && (n.setAttribute("is", t=t.toLowerCase()), i && (i=c(a.toUpperCase(), t))), me=!r.createElement.innerHTMLHelper, i && y(n, H[l]), n }, re.cloneNode=function(e) { var t=ie.call(this, !!e), r=u(t); return -1 < r && y(t, H[r]), e && i(t.querySelectorAll(x)), t }), -2 < G.call(U, k + n) + G.call(U, _ + n) && b(e), !q.test(n) || -1 < G.call(S, n)) throw new Error("The type " + e + " is invalid"); var n, a, s=function() { return v ? r.createElement(p, n) : r.createElement(p) }, h=t || j, v=z.call(h, M), p=v ? t[M].toUpperCase() : n; return v && -1 < G.call(U, _ + p) && b(p), a=U.push((v ? k : _) + n) - 1, x=x.concat(x.length ? "," : "" , v ? p + '[is="' + e.toLowerCase() + '"]' : p), s.prototype=H[a]=z.call(h, "prototype" ) ? h.prototype : Q(re), l(r.querySelectorAll(x), L), s } } }(window, document, Object, "registerElement" ); }, {}], 14: [function(_dereq_, module, exports) { module.exports=function(r) { switch (r) { case "int8" : return Int8Array; case "int16" : return Int16Array; case "int32" : return Int32Array; case "uint8" : return Uint8Array; case "uint16" : return Uint16Array; case "uint32" : return Uint32Array; case "float32" : return Float32Array; case "float64" : return Float64Array; case "array" : return Array; case "uint8_clamped" : return Uint8ClampedArray } }; }, {}], 15: [function(_dereq_, module, exports) { function flattenVertexData(e, t, r) { if (!e) throw new TypeError("must specify data as first parameter"); if (r=0 | +(r || 0), Array.isArray(e) && e[0] && "number"==typeof e[0][0]) { var n, a, l, o, f=e[0].length, s=e.length * f; t && "string" !=typeof t || (t=new(dtype(t || "float32" ))(s + r)); var i=t.length - r; if (s !==i) throw new Error("source length " + s + " (" + f + "x" + e.length + ") does not match destination length " + i); for (n=0, l=r; n < e.length; n++) for (a=0; a < f; a++) t[l++]=null===e[n][a] ? NaN : e[n][a] } else if (t && "string" !=typeof t) t.set(e, r); else { var y=dtype(t || "float32" ); if (Array.isArray(e) || "array"===t) for (t=new y(e.length + r), n=0, l=r, o=t.length; l < o; l++, n++) t[l]=null===e[n] ? NaN : e[n]; else 0===r ? t=new y(e) : (t=new y(e.length + r), t.set(e, r)) } return t } var dtype=_dereq_("dtype"); module.exports=flattenVertexData; }, { "dtype" : 14 }], 16: [function(_dereq_, module, exports) { "use strict" ; var isCallable=_dereq_("is-callable"), toStr=Object.prototype.toString, hasOwnProperty=Object.prototype.hasOwnProperty, forEachArray=function(r, t, a) { for (var o=0, l=r.length; o < l; o++) hasOwnProperty.call(r, o) && (null==a ? t(r[o], o, r) : t.call(a, r[o], o, r)) }, forEachString=function(r, t, a) { for (var o=0, l=r.length; o < l; o++) null==a ? t(r.charAt(o), o, r) : t.call(a, r.charAt(o), o, r) }, forEachObject=function(r, t, a) { for (var o in r) hasOwnProperty.call(r, o) && (null==a ? t(r[o], o, r) : t.call(a, r[o], o, r)) }, forEach=function(r, t, a) { if (!isCallable(t)) throw new TypeError("iterator must be a function"); var o; arguments.length>= 3 && (o = a), "[object Array]" === toStr.call(r) ? forEachArray(r, t, o) : "string" == typeof r ? forEachString(r, t, o) : forEachObject(r, t, o)
};
module.exports = forEach;
}, {
"is-callable": 21
}],
17: [function(_dereq_, module, exports) {
(function(global) {
var win;
win = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self : {}, module.exports = win;
}).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
}, {}],
18: [function(_dereq_, module, exports) {
exports.read = function(a, o, t, r, h) {
var M, p, w = 8 * h - r - 1,
f = (1 << w) - 1, e=f>> 1,
i = -7,
N = t ? h - 1 : 0,
n = t ? -1 : 1,
s = a[o + N];
for (N += n, M = s & (1 << -i) - 1, s>>= -i, i += w; i > 0; M = 256 * M + a[o + N], N += n, i -= 8);
for (p = M & (1 << -i) - 1, M>>= -i, i += r; i > 0; p = 256 * p + a[o + N], N += n, i -= 8);
if (0 === M) M = 1 - e;
else {
if (M === f) return p ? NaN : 1 / 0 * (s ? -1 : 1);
p += Math.pow(2, r), M -= e
}
return (s ? -1 : 1) * p * Math.pow(2, M - r)
}, exports.write = function(a, o, t, r, h, M) {
var p, w, f, e = 8 * M - h - 1,
i = (1 << e) - 1, N=i>> 1,
n = 23 === h ? Math.pow(2, -24) - Math.pow(2, -77) : 0,
s = r ? 0 : M - 1,
u = r ? 1 : -1,
l = o < 0 || 0===o && 1 / o < 0 ? 1 : 0; for (o=Math.abs(o), isNaN(o) || o===1 / 0 ? (w=isNaN(o) ? 1 : 0, p=i) : (p=Math.floor(Math.log(o) / Math.LN2), o * (f=Math.pow(2, -p)) < 1 && (p--, f *=2), o +=p + N>= 1 ? n / f : n * Math.pow(2, 1 - N), o * f >= 2 && (p++, f /= 2), p + N >= i ? (w = 0, p = i) : p + N >= 1 ? (w = (o * f - 1) * Math.pow(2, h), p += N) : (w = o * Math.pow(2, N - 1) * Math.pow(2, h), p = 0)); h >= 8; a[t + s] = 255 & w, s += u, w /= 256, h -= 8);
for (p = p << h | w, e +=h; e> 0; a[t + s] = 255 & p, s += u, p /= 256, e -= 8);
a[t + s - u] |= 128 * l
};
}, {}],
19: [function(_dereq_, module, exports) {
"function" == typeof Object.create ? module.exports = function(t, e) {
t.super_ = e, t.prototype = Object.create(e.prototype, {
constructor: {
value: t,
enumerable: !1,
writable: !0,
configurable: !0
}
})
} : module.exports = function(t, e) {
t.super_ = e;
var o = function() {};
o.prototype = e.prototype, t.prototype = new o, t.prototype.constructor = t
};
}, {}],
20: [function(_dereq_, module, exports) {
function isBuffer(f) {
return !!f.constructor && "function" == typeof f.constructor.isBuffer && f.constructor.isBuffer(f)
}
function isSlowBuffer(f) {
return "function" == typeof f.readFloatLE && "function" == typeof f.slice && isBuffer(f.slice(0, 0))
}
module.exports = function(f) {
return null != f && (isBuffer(f) || isSlowBuffer(f) || !!f._isBuffer)
};
}, {}],
21: [function(_dereq_, module, exports) {
"use strict";
var fnToStr = Function.prototype.toString,
constructorRegex = /^\s*class\b/,
isES6ClassFn = function(t) {
try {
var n = fnToStr.call(t);
return constructorRegex.test(n)
} catch (t) {
return !1
}
},
tryFunctionObject = function(t) {
try {
return !isES6ClassFn(t) && (fnToStr.call(t), !0)
} catch (t) {
return !1
}
},
toStr = Object.prototype.toString,
fnClass = "[object Function]",
genClass = "[object GeneratorFunction]",
hasToStringTag = "function" == typeof Symbol && "symbol" == typeof Symbol.toStringTag;
module.exports = function(t) {
if (!t) return !1;
if ("function" != typeof t && "object" != typeof t) return !1;
if ("function" == typeof t && !t.prototype) return !0;
if (hasToStringTag) return tryFunctionObject(t);
if (isES6ClassFn(t)) return !1;
var n = toStr.call(t);
return n === fnClass || n === genClass
};
}, {}],
22: [function(_dereq_, module, exports) {
function isFunction(o) {
var t = toString.call(o);
return "[object Function]" === t || "function" == typeof o && "[object RegExp]" !== t || "undefined" != typeof window && (o === window.setTimeout || o === window.alert || o === window.confirm || o === window.prompt)
}
module.exports = isFunction;
var toString = Object.prototype.toString;
}, {}],
23: [function(_dereq_, module, exports) {
"use strict";
module.exports = function(t) {
var e = typeof t;
return null !== t && ("object" === e || "function" === e)
};
}, {}],
24: [function(_dereq_, module, exports) {
function TextLayout(t) {
this.glyphs = [], this._measure = this.computeMetrics.bind(this), this.update(t)
}
function addGetter(t) {
Object.defineProperty(TextLayout.prototype, t, {
get: wrapper(t),
configurable: !0
})
}
function wrapper(t) {
return new Function(["return function " + t + "() {", " return this._" + t, "}"].join("\n"))()
}
function getGlyphById(t, e) {
if (!t.chars || 0 === t.chars.length) return null;
var r = findChar(t.chars, e);
return r >= 0 ? t.chars[r] : null
}
function getXHeight(t) {
for (var e = 0; e < X_HEIGHTS.length; e++) { var r=X_HEIGHTS[e].charCodeAt(0), n=findChar(t.chars, r); if (n>= 0) return t.chars[n].height
}
return 0
}
function getMGlyph(t) {
for (var e = 0; e < M_WIDTHS.length; e++) { var r=M_WIDTHS[e].charCodeAt(0), n=findChar(t.chars, r); if (n>= 0) return t.chars[n]
}
return 0
}
function getCapHeight(t) {
for (var e = 0; e < CAP_HEIGHTS.length; e++) { var r=CAP_HEIGHTS[e].charCodeAt(0), n=findChar(t.chars, r); if (n>= 0) return t.chars[n].height
}
return 0
}
function getKerning(t, e, r) {
if (!t.kernings || 0 === t.kernings.length) return 0;
for (var n = t.kernings, i = 0; i < n.length; i++) { var a=n[i]; if (a.first===e && a.second===r) return a.amount } return 0 } function getAlignType(t) { return "center"===t ? ALIGN_CENTER : "right"===t ? ALIGN_RIGHT : ALIGN_LEFT } function findChar(t, e, r) { r=r || 0; for (var n=r; n < t.length; n++) if (t[n].id===e) return n; return -1 } var wordWrap=_dereq_("word-wrapper"), xtend=_dereq_("xtend"), number=_dereq_("as-number"), X_HEIGHTS=["x", "e" , "a" , "o" , "n" , "s" , "r" , "c" , "u" , "m" , "v" , "w" , "z" ], M_WIDTHS=["m", "w" ], CAP_HEIGHTS=["H", "I" , "N" , "E" , "F" , "K" , "L" , "T" , "U" , "V" , "W" , "X" , "Y" , "Z" ], TAB_ID="\t" .charCodeAt(0), SPACE_ID=" " .charCodeAt(0), ALIGN_LEFT=0, ALIGN_CENTER=1, ALIGN_RIGHT=2; module.exports=function(t) { return new TextLayout(t) }, TextLayout.prototype.update=function(t) { if (t=xtend({ measure: this._measure }, t), this._opt=t, this._opt.tabSize=number(this._opt.tabSize, 4), !t.font) throw new Error("must provide a valid bitmap font"); var e=this.glyphs, r=t.text || "" , n=t.font; this._setupSpaceGlyphs(n); var i=wordWrap.lines(r, t), a=t.width || 0; e.length=0; var h=i.reduce(function(t, e) { return Math.max(t, e.width, a) }, 0), o=0, s=0, c=number(t.lineHeight, n.common.lineHeight), u=n.common.base, l=c - u, p=t.letterSpacing || 0, f=c * i.length - l, d=getAlignType(this._opt.align); s -=f, this._width=h, this._height=f, this._descender=c - u, this._baseline=u, this._xHeight=getXHeight(n), this._capHeight=getCapHeight(n), this._lineHeight=c, this._ascender=c - l - this._xHeight; var g=this; i.forEach(function(t, i) { for (var a, u=t.start, l=t.end, f=t.width, _=u; _ < l; _++) { var y=r.charCodeAt(_), G=g.getGlyph(n, y); if (G) { a && (o +=getKerning(n, a.id, G.id)); var T=o; d===ALIGN_CENTER ? T +=(h - f) / 2 : d===ALIGN_RIGHT && (T +=h - f), e.push({ position: [T, s], data: G, index: _, line: i }), o +=G.xadvance + p, a=G } } s +=c, o=0 }), this._linesTotal=i.length }, TextLayout.prototype._setupSpaceGlyphs=function(t) { if (this._fallbackSpaceGlyph=null, this._fallbackTabGlyph=null, t.chars && 0 !==t.chars.length) { var e=getGlyphById(t, SPACE_ID) || getMGlyph(t) || t.chars[0], r=this._opt.tabSize * e.xadvance; this._fallbackSpaceGlyph=e, this._fallbackTabGlyph=xtend(e, { x: 0, y: 0, xadvance: r, id: TAB_ID, xoffset: 0, yoffset: 0, width: 0, height: 0 }) } }, TextLayout.prototype.getGlyph=function(t, e) { var r=getGlyphById(t, e); return r || (e===TAB_ID ? this._fallbackTabGlyph : e===SPACE_ID ? this._fallbackSpaceGlyph : null) }, TextLayout.prototype.computeMetrics=function(t, e, r, n) { var i, a, h=this._opt.letterSpacing || 0, o=this._opt.font, s=0, c=0, u=0; if (!o.chars || 0===o.chars.length) return { start: e, end: e, width: 0 }; r=Math.min(t.length, r); for (var l=e; l < r; l++) { var p=t.charCodeAt(l), i=this.getGlyph(o, p); if (i) { i.xoffset; s +=a ? getKerning(o, a.id, i.id) : 0; var f=s + i.xadvance + h, d=s + i.width; if (d>= n || f >= n) break;
s = f, c = d, a = i
}
u++
}
return a && (c += a.xoffset), {
start: e,
end: e + u,
width: c
}
}, ["width", "height", "descender", "ascender", "xHeight", "baseline", "capHeight", "lineHeight"].forEach(addGetter);
}, {
"as-number": 2,
"word-wrapper": 50,
"xtend": 53
}],
25: [function(_dereq_, module, exports) {
(function(Buffer) {
function isArrayBuffer(r) {
return "[object ArrayBuffer]" === Object.prototype.toString.call(r)
}
function getBinaryOpts(r) {
if (xml2) return xtend(r, {
responseType: "arraybuffer"
});
if (void 0 === self.XMLHttpRequest) throw new Error("your browser does not support XHR loading");
var e = new self.XMLHttpRequest;
return e.overrideMimeType("text/plain; charset=x-user-defined"), xtend({
xhr: e
}, r)
}
var xhr = _dereq_("xhr"),
noop = function() {},
parseASCII = _dereq_("parse-bmfont-ascii"),
parseXML = _dereq_("parse-bmfont-xml"),
readBinary = _dereq_("parse-bmfont-binary"),
isBinaryFormat = _dereq_("./lib/is-binary"),
xtend = _dereq_("xtend"),
xml2 = function() {
return self.XMLHttpRequest && "withCredentials" in new XMLHttpRequest
}();
module.exports = function(r, e) {
e = "function" == typeof e ? e : noop, "string" == typeof r ? r = {
uri: r
} : r || (r = {}), r.binary && (r = getBinaryOpts(r)), xhr(r, function(t, n, i) {
if (t) return e(t);
if (!/^2/.test(n.statusCode)) return e(new Error("http status code: " + n.statusCode));
if (!i) return e(new Error("no body result"));
var o = !1;
if (isArrayBuffer(i)) {
var a = new Uint8Array(i);
i = new Buffer(a, "binary")
}
isBinaryFormat(i) && (o = !0, "string" == typeof i && (i = new Buffer(i, "binary"))), o || (Buffer.isBuffer(i) && (i = i.toString(r.encoding)), i = i.trim());
var s;
try {
var u = n.headers["content-type"];
s = o ? readBinary(i) : /json/.test(u) || "{" === i.charAt(0) ? JSON.parse(i) : /xml/.test(u) || "<"===i.charAt(0) ? parseXML(i) : parseASCII(i) } catch (r) { e(new Error("error parsing font " + r.message)), e = noop
}
e(null, s)
})
};
}).call(this, _dereq_(" buffer").Buffer) }, { "./lib/is-binary" : 26, "buffer" : 7, "parse-bmfont-ascii" : 28, "parse-bmfont-binary" : 29, "parse-bmfont-xml" : 30, "xhr" : 51, "xtend" : 53 }], 26: [function(_dereq_, module, exports) { (function(Buffer) { var equal=_dereq_("buffer-equal"), HEADER=new Buffer([66, 77, 70, 3]); module.exports=function(e) { return "string"==typeof e ? "BMF"===e.substring(0, 3) : e.length> 4 && equal(e.slice(0, 4), HEADER)
};
}).call(this, _dereq_("buffer").Buffer)
}, {
"buffer": 7,
"buffer-equal": 6
}],
27: [function(_dereq_, module, exports) {
"use strict";
function toObject(e) {
if (null === e || void 0 === e) throw new TypeError("Object.assign cannot be called with null or undefined");
return Object(e)
}
function shouldUseNative() {
try {
if (!Object.assign) return !1;
var e = new String("abc");
if (e[5] = "de", "5" === Object.getOwnPropertyNames(e)[0]) return !1;
for (var r = {}, t = 0; t < 10; t++) r["_" + String.fromCharCode(t)]=t; if ("0123456789" !==Object.getOwnPropertyNames(r).map(function(e) { return r[e] }).join("")) return !1; var n={}; return "abcdefghijklmnopqrst" .split("").forEach(function(e) { n[e]=e }), "abcdefghijklmnopqrst"===Object.keys(Object.assign({}, n)).join("") } catch (e) { return !1 } } var getOwnPropertySymbols=Object.getOwnPropertySymbols, hasOwnProperty=Object.prototype.hasOwnProperty, propIsEnumerable=Object.prototype.propertyIsEnumerable; module.exports=shouldUseNative() ? Object.assign : function(e, r) { for (var t, n, o=toObject(e), a=1; a < arguments.length; a++) { t=Object(arguments[a]); for (var s in t) hasOwnProperty.call(t, s) && (o[s]=t[s]); if (getOwnPropertySymbols) { n=getOwnPropertySymbols(t); for (var c=0; c < n.length; c++) propIsEnumerable.call(t, n[c]) && (o[n[c]]=t[n[c]]) } } return o }; }, {}], 28: [function(_dereq_, module, exports) { function splitLine(e, r) { if (!(e=e.replace(/\t+/g, " " ).trim())) return null; var t=e.indexOf(" ");
if (-1 === t) throw new Error(" no named row at line " + r);
var a = e.substring(0, t);
e = e.substring(t + 1), e = e.replace(/letter=[\'\" ]\S+[\'\"]/gi, "" ), e=e.split("="), e = e.map(function(e) {
return e.trim().match(/(" .*?"|[^"\s]+)+(?=\s*|\s*$)/g) }); for (var n=[], i=0; i < e.length; i++) { var s=e[i]; 0===i ? n.push({ key: s[0], data: "" }) : i===e.length - 1 ? n[n.length - 1].data=parseData(s[0]) : (n[n.length - 1].data=parseData(s[0]), n.push({ key: s[1], data: "" })) } var o={ key: a, data: {} }; return n.forEach(function(e) { o.data[e.key]=e.data }), o } function parseData(e) { return e && 0 !==e.length ? 0===e.indexOf('"') || 0===e.indexOf("'") ? e.substring(1, e.length - 1) : -1 !==e.indexOf(",") ? parseIntList(e) : parseInt(e, 10) : "" } function parseIntList(e) { return e.split(",").map(function(e) { return parseInt(e, 10) }) } module.exports=function(e) { if (!e) throw new Error("no data provided"); e=e.toString().trim(); var r={ pages: [], chars: [], kernings: [] }, t=e.split(/\r\n?|\n/g); if (0===t.length) throw new Error("no data in BMFont file"); for (var a=0; a < t.length; a++) { var n=splitLine(t[a], a); if (n) if ("page"===n.key) { if ("number" !=typeof n.data.id) throw new Error("malformed file at line " + a + " -- needs page id=N"); if ("string" !=typeof n.data.file) throw new Error("malformed file at line " + a + ' -- needs page file=" path"'); r.pages[n.data.id]=n.data.file } else "chars"===n.key || "kernings"===n.key || ("char"===n.key ? r.chars.push(n.data) : "kerning"===n.key ? r.kernings.push(n.data) : r[n.key]=n.data) } return r }; }, {}], 29: [function(_dereq_, module, exports) { function readBlock(r, e, n) { if (n> e.length - 1) return 0;
var a = e.readUInt8(n++),
t = e.readInt32LE(n);
switch (n += 4, a) {
case 1:
r.info = readInfo(e, n);
break;
case 2:
r.common = readCommon(e, n);
break;
case 3:
r.pages = readPages(e, n, t);
break;
case 4:
r.chars = readChars(e, n, t);
break;
case 5:
r.kernings = readKernings(e, n, t)
}
return 5 + t
}
function readInfo(r, e) {
var n = {};
n.size = r.readInt16LE(e);
var a = r.readUInt8(e + 2);
return n.smooth = a >> 7 & 1, n.unicode = a >> 6 & 1, n.italic = a >> 5 & 1, n.bold = a >> 4 & 1, a >> 3 & 1 && (n.fixedHeight = 1), n.charset = r.readUInt8(e + 3) || "", n.stretchH = r.readUInt16LE(e + 4), n.aa = r.readUInt8(e + 6), n.padding = [r.readInt8(e + 7), r.readInt8(e + 8), r.readInt8(e + 9), r.readInt8(e + 10)], n.spacing = [r.readInt8(e + 11), r.readInt8(e + 12)], n.outline = r.readUInt8(e + 13), n.face = readStringNT(r, e + 14), n
}
function readCommon(r, e) {
var n = {};
n.lineHeight = r.readUInt16LE(e), n.base = r.readUInt16LE(e + 2), n.scaleW = r.readUInt16LE(e + 4), n.scaleH = r.readUInt16LE(e + 6), n.pages = r.readUInt16LE(e + 8);
r.readUInt8(e + 10);
return n.packed = 0, n.alphaChnl = r.readUInt8(e + 11), n.redChnl = r.readUInt8(e + 12), n.greenChnl = r.readUInt8(e + 13), n.blueChnl = r.readUInt8(e + 14), n
}
function readPages(r, e, n) {
for (var a = [], t = readNameNT(r, e), d = t.length + 1, o = n / d, i = 0; i < o; i++) a[i]=r.slice(e, e + t.length).toString("utf8"), e +=d; return a } function readChars(r, e, n) { for (var a=[], t=n / 20, d=0; d < t; d++) { var o={}, i=20 * d; o.id=r.readUInt32LE(e + 0 + i), o.x=r.readUInt16LE(e + 4 + i), o.y=r.readUInt16LE(e + 6 + i), o.width=r.readUInt16LE(e + 8 + i), o.height=r.readUInt16LE(e + 10 + i), o.xoffset=r.readInt16LE(e + 12 + i), o.yoffset=r.readInt16LE(e + 14 + i), o.xadvance=r.readInt16LE(e + 16 + i), o.page=r.readUInt8(e + 18 + i), o.chnl=r.readUInt8(e + 19 + i), a[d]=o } return a } function readKernings(r, e, n) { for (var a=[], t=n / 10, d=0; d < t; d++) { var o={}, i=10 * d; o.first=r.readUInt32LE(e + 0 + i), o.second=r.readUInt32LE(e + 4 + i), o.amount=r.readInt16LE(e + 8 + i), a[d]=o } return a } function readNameNT(r, e) { for (var n=e; n < r.length && 0 !==r[n]; n++); return r.slice(e, n) } function readStringNT(r, e) { return readNameNT(r, e).toString("utf8") } var HEADER=[66, 77, 70]; module.exports=function(r) { if (r.length < 6) throw new Error("invalid buffer length for BMFont"); if (!HEADER.every(function(e, n) { return r.readUInt8(n)===e })) throw new Error("BMFont missing BMF byte header"); var e=3; if (r.readUInt8(e++)> 3) throw new Error("Only supports BMFont Binary v3 (BMFont App v1.10)");
for (var n = {
kernings: [],
chars: []
}, a = 0; a < 5; a++) e +=readBlock(n, r, e); return n }; }, {}], 30: [function(_dereq_, module, exports) { function getAttribs(e) { return getAttribList(e).reduce(function(e, t) { return e[mapName(t.nodeName)]=t.nodeValue, e }, {}) } function getAttribList(e) { for (var t=[], r=0; r < e.attributes.length; r++) t.push(e.attributes[r]); return t } function mapName(e) { return NAME_MAP[e.toLowerCase()] || e } var parseAttributes=_dereq_("./parse-attribs"), parseFromString=_dereq_("xml-parse-from-string"), NAME_MAP={ scaleh: "scaleH" , scalew: "scaleW" , stretchh: "stretchH" , lineheight: "lineHeight" , alphachnl: "alphaChnl" , redchnl: "redChnl" , greenchnl: "greenChnl" , bluechnl: "blueChnl" }; module.exports=function(e) { e=e.toString(); var t=parseFromString(e), r={ pages: [], chars: [], kernings: [] }; ["info", "common" ].forEach(function(e) { var a=t.getElementsByTagName(e)[0]; a && (r[e]=parseAttributes(getAttribs(a))) }); var a=t.getElementsByTagName("pages")[0]; if (!a) throw new Error("malformed file -- no element");
for (var n = a.getElementsByTagName("page"), i = 0; i < n.length; i++) { var s=n[i], g=parseInt(s.getAttribute("id"), 10), l=s.getAttribute("file"); if (isNaN(g)) throw new Error('malformed file -- page "id" attribute is NaN'); if (!l) throw new Error('malformed file -- needs page "file" attribute'); r.pages[parseInt(g, 10)]=l } return ["chars", "kernings" ].forEach(function(e) { var a=t.getElementsByTagName(e)[0]; if (a) for (var n=e.substring(0, e.length - 1), i=a.getElementsByTagName(n), s=0; s < i.length; s++) { var g=i[s]; r[e].push(parseAttributes(getAttribs(g))) } }), r }; }, { "./parse-attribs" : 31, "xml-parse-from-string" : 52 }], 31: [function(_dereq_, module, exports) { function parseIntList(t) { return t.split(",").map(function(t) { return parseInt(t, 10) }) } var GLYPH_DESIGNER_ERROR="chasrset" ; module.exports=function(t) { GLYPH_DESIGNER_ERROR in t && (t.charset=t[GLYPH_DESIGNER_ERROR], delete t[GLYPH_DESIGNER_ERROR]); for (var n in t) "face" !==n && "charset" !==n && (t[n]="padding"===n || "spacing"===n ? parseIntList(t[n]) : parseInt(t[n], 10)); return t }; }, {}], 32: [function(_dereq_, module, exports) { var trim=_dereq_("trim"), forEach=_dereq_("for-each"), isArray=function(r) { return "[object Array]"===Object.prototype.toString.call(r) }; module.exports=function(r) { if (!r) return {}; var t={}; return forEach(trim(r).split("\n"), function(r) { var i=r.indexOf(":"), e=trim(r.slice(0, i)).toLowerCase(), o=trim(r.slice(i + 1)); void 0===t[e] ? t[e]=o : isArray(t[e]) ? t[e].push(o) : t[e]=[t[e], o] }), t }; }, { "for-each" : 16, "trim" : 48 }], 33: [function(_dereq_, module, exports) { (function(global) { var performance=global.performance || {}, present=function() { for (var e=["now", "webkitNow" , "msNow" , "mozNow" , "oNow" ]; e.length;) { var n=e.shift(); if (n in performance) return performance[n].bind(performance) } var r=Date.now || function() { return (new Date).getTime() }, o=(performance.timing || {}).navigationStart || r(); return function() { return r() - o } }(); present.performanceNow=performance.now, present.noConflict=function() { performance.now=present.performanceNow }, present.conflict=function() { performance.now=present }, present.conflict(), module.exports=present; }).call(this, typeof global !=="undefined" ? global : typeof self !=="undefined" ? self : typeof window !=="undefined" ? window : {}) }, {}], 34: [function(_dereq_, module, exports) { (function(setImmediate) { ! function(t) { function e(t, e) { return function() { t.apply(e, arguments) } } function n(t) { if ("object" !=typeof this) throw new TypeError("Promises must be constructed via new"); if ("function" !=typeof t) throw new TypeError("not a function"); this._state=null, this._value=null, this._deferreds=[], f(t, e(r, this), e(i, this)) } function o(t) { var e=this; if (null===this._state) return void this._deferreds.push(t); l(function() { var n=e._state ? t.onFulfilled : t.onRejected; if (null===n) return void(e._state ? t.resolve : t.reject)(e._value); var o; try { o=n(e._value) } catch (e) { return void t.reject(e) } t.resolve(o) }) } function r(t) { try { if (t===this) throw new TypeError("A promise cannot be resolved with itself."); if (t && ("object"==typeof t || "function"==typeof t)) { var n=t.then; if ("function"==typeof n) return void f(e(n, t), e(r, this), e(i, this)) } this._state=!0, this._value=t, u.call(this) } catch (t) { i.call(this, t) } } function i(t) { this._state=!1, this._value=t, u.call(this) } function u() { for (var t=0, e=this._deferreds.length; t < e; t++) o.call(this, this._deferreds[t]); this._deferreds=null } function c(t, e, n, o) { this.onFulfilled="function"==typeof t ? t : null, this.onRejected="function"==typeof e ? e : null, this.resolve=n, this.reject=o } function f(t, e, n) { var o=!1; try { t(function(t) { o || (o=!0, e(t)) }, function(t) { o || (o=!0, n(t)) }) } catch (t) { if (o) return; o=!0, n(t) } } var s=setTimeout, l="function"==typeof setImmediate && setImmediate || function(t) { s(t, 1) }, h=Array.isArray || function(t) { return "[object Array]"===Object.prototype.toString.call(t) }; n.prototype.catch=function(t) { return this.then(null, t) }, n.prototype.then=function(t, e) { var r=this; return new n(function(n, i) { o.call(r, new c(t, e, n, i)) }) }, n.all=function() { var t=Array.prototype.slice.call(1===arguments.length && h(arguments[0]) ? arguments[0] : arguments); return new n(function(e, n) { function o(i, u) { try { if (u && ("object"==typeof u || "function"==typeof u)) { var c=u.then; if ("function"==typeof c) return void c.call(u, function(t) { o(i, t) }, n) } t[i]=u, 0==--r && e(t) } catch (t) { n(t) } } if (0===t.length) return e([]); for (var r=t.length, i=0; i < t.length; i++) o(i, t[i]) }) }, n.resolve=function(t) { return t && "object"==typeof t && t.constructor===n ? t : new n(function(e) { e(t) }) }, n.reject=function(t) { return new n(function(e, n) { n(t) }) }, n.race=function(t) { return new n(function(e, n) { for (var o=0, r=t.length; o < r; o++) t[o].then(e, n) }) }, n._setImmediateFn=function(t) { l=t }, "undefined" !=typeof module && module.exports ? module.exports=n : t.Promise || (t.Promise=n) }(this); }).call(this, _dereq_("timers").setImmediate) }, { "timers" : 46 }], 35: [function(_dereq_, module, exports) { var dtype=_dereq_("dtype"), anArray=_dereq_("an-array"), isBuffer=_dereq_("is-buffer"), CW=[0, 2, 3], CCW=[2, 1, 3]; module.exports=function(r, e) { r && (anArray(r) || isBuffer(r)) || (e=r || {}, r=null), e="number"==typeof e ? { count: e } : e || {}; for (var t="string"==typeof e.type ? e.type : "uint16" , u="number"==typeof e.count ? e.count : 1, n=e.start || 0, a=!1 !==e.clockwise ? CW : CCW, f=a[0], o=a[1], y=a[2], i=6 * u, p=r || new(dtype(t))(i), s=0, c=0; s < i; s +=6, c +=4) { var C=s + n; p[C + 0]=c + 0, p[C + 1]=c + 1, p[C + 2]=c + 2, p[C + 3]=c + f, p[C + 4]=c + o, p[C + 5]=c + y } return p }; }, { "an-array" : 1, "dtype" : 14, "is-buffer" : 20 }], 36: [function(_dereq_, module, exports) { "use strict" ; function minMax(e, t, n) { return Math.min(Math.max(e, t), n) } function stringContains(e, t) { return e.indexOf(t)> -1
}
function applyArguments(e, t) {
return e.apply(null, t)
}
function parseEasingParameters(e) {
var t = easingFunctionRegex.exec(e);
return t ? t[1].split(",").map(function(e) {
return parseFloat(e)
}) : []
}
function spring(e, t) {
function n(e) {
var n = t ? t * e / 1e3 : e;
return n = l < 1 ? Math.exp(-n * l * c) * (f * Math.cos(g * n) + p * Math.sin(g * n)) : (f + p * n) * Math.exp(-n * c), 0===e || 1===e ? e : 1 - n } function r() { var t=cache.springs[e]; if (t) return t; for (var r=0, a=0;;) if (r +=1 / 6, 1===n(r)) { if (++a>= 16) break
} else a = 0;
var i = r * (1 / 6) * 1e3;
return cache.springs[e] = i, i
}
var a = parseEasingParameters(e),
i = minMax(is.und(a[0]) ? 1 : a[0], .1, 100),
s = minMax(is.und(a[1]) ? 100 : a[1], .1, 100),
o = minMax(is.und(a[2]) ? 10 : a[2], .1, 100),
u = minMax(is.und(a[3]) ? 0 : a[3], .1, 100),
c = Math.sqrt(s / i),
l = o / (2 * Math.sqrt(s * i)),
g = l < 1 ? c * Math.sqrt(1 - l * l) : 0, f=1, p=l < 1 ? (l * c - u) / g : -u + c; return t ? n : r } function elastic(e, t) { void 0===e && (e=1), void 0===t && (t=.5); var n=minMax(e, 1, 10), r=minMax(t, .1, 2); return function(e) { return 0===e || 1===e ? e : -n * Math.pow(2, 10 * (e - 1)) * Math.sin((e - 1 - r / (2 * Math.PI) * Math.asin(1 / n)) * (2 * Math.PI) / r) } } function steps(e) { return void 0===e && (e=10), function(t) { return Math.round(t * e) * (1 / e) } } function parseEasings(e, t) { if (is.fnc(e)) return e; var n=e.split("(")[0], r=penner[n], a=parseEasingParameters(e); switch (n) { case "spring" : return spring(e, t); case "cubicBezier" : return applyArguments(bezier, a); case "steps" : return applyArguments(steps, a); default: return is.fnc(r) ? applyArguments(r, a) : applyArguments(bezier, r) } } function selectString(e) { try { return document.querySelectorAll(e) } catch (e) { return } } function filterArray(e, t) { for (var n=auxArrayFilter, r=e.length, a=arguments.length>= 2 ? arguments[1] : void 0, i = 0; i < r; i++) if (i in e) { var s=e[i]; t.call(a, s, i, e) && n.push(s) } return auxArrayFilter=e, auxArrayFilter.length=0, n } function flattenArray(e, t) { t || (t=[]); for (var n=0, r=e.length; n < r; n++) { var a=e[n]; Array.isArray(a) ? flattenArray(a, t) : t.push(a) } return t } function toArray(e) { return is.arr(e) ? e : (is.str(e) && (e=selectString(e) || e), e instanceof NodeList || e instanceof HTMLCollection ? [].slice.call(e) : [e]) } function arrayContains(e, t) { return e.some(function(e) { return e===t }) } function cloneObject(e) { var t={}; for (var n in e) t[n]=e[n]; return t } function replaceObjectProps(e, t) { var n=cloneObject(e); for (var r in e) n[r]=t.hasOwnProperty(r) ? t[r] : e[r]; return n } function mergeObjects(e, t) { var n=cloneObject(e); for (var r in t) n[r]=is.und(e[r]) ? t[r] : e[r]; return n } function rgbToRgba(e) { var t=rgbRegex.exec(e); return t ? "rgba(" + t[1] + ",1)" : e } function hexToRgba(e) { var t=e.replace(hexToRgbaHexRegex, function(e, t, n, r) { return t + t + n + n + r + r }), n=hexToRgbaRgbRegex.exec(t); return "rgba(" + parseInt(n[1], 16) + "," + parseInt(n[2], 16) + "," + parseInt(n[3], 16) + ",1)" } function hslToRgba(e) { function t(e, t, n) { return n < 0 && (n +=1), n> 1 && (n -= 1), n < 1 / 6 ? e + 6 * (t - e) * n : n < .5 ? t : n < 2 / 3 ? e + (t - e) * (2 / 3 - n) * 6 : e } var n, r, a, i=hslToRgbaHsl1Regex.exec(e) || hslToRgbaHsl2Regex.exec(e), s=parseInt(i[1], 10) / 360, o=parseInt(i[2], 10) / 100, u=parseInt(i[3], 10) / 100, c=i[4] || 1; if (0==o) n=r=a=u; else { var l=u < .5 ? u * (1 + o) : u + o - u * o, g=2 * u - l; n=t(g, l, s + 1 / 3), r=t(g, l, s), a=t(g, l, s - 1 / 3) } return "rgba(" + 255 * n + "," + 255 * r + "," + 255 * a + "," + c + ")" } function colorToRgb(e) { return is.rgb(e) ? rgbToRgba(e) : is.hex(e) ? hexToRgba(e) : is.hsl(e) ? hslToRgba(e) : void 0 } function getUnit(e) { var t=unitRegex.exec(e); if (t) return t[2] } function getTransformUnit(e) { return stringContains(e, "translate" ) || "perspective"===e ? "px" : stringContains(e, "rotate" ) || stringContains(e, "skew" ) ? "deg" : void 0 } function getFunctionValue(e, t) { return is.fnc(e) ? e(t.target, t.id, t.total) : e } function getAttribute(e, t) { return e.getAttribute(t) } function convertPxToUnit(e, t, n) { if (arrayContains([n, "deg" , "rad" , "turn" ], getUnit(t))) return t; var r=cache.CSS[t + n]; if (!is.und(r)) return r; var a=document.createElement(e.tagName), i=e.parentNode && e.parentNode !==document ? e.parentNode : document.body; i.appendChild(a), a.style.position="absolute" , a.style.width=100 + n; var s=100 / a.offsetWidth; i.removeChild(a); var o=s * parseFloat(t); return cache.CSS[t + n]=o, o } function getCSSValue(e, t, n) { if (t in e.style) { var r=t.replace(/([a-z])([A-Z])/g, "$1-$2" ).toLowerCase(), a=e.style[t] || getComputedStyle(e).getPropertyValue(r) || "0" ; return n ? convertPxToUnit(e, a, n) : a } } function getAnimationType(e, t) { return is.dom(e) && !is.inp(e) && (getAttribute(e, t) || is.svg(e) && e[t]) ? "attribute" : is.dom(e) && arrayContains(validTransforms, t) ? "transform" : is.dom(e) && "transform" !==t && getCSSValue(e, t) ? "css" : null !=e[t] ? "object" : void 0 } function getElementTransforms(e) { if (is.dom(e)) { for (var t, n=e.style.transform || "" , r=new Map; t=transformRegex.exec(n);) r.set(t[1], t[2]); return r } } function getTransformValue(e, t, n, r) { var a=stringContains(t, "scale" ) ? 1 : 0 + getTransformUnit(t), i=getElementTransforms(e).get(t) || a; return n && (n.transforms.list.set(t, i), n.transforms.last=t), r ? convertPxToUnit(e, i, r) : i } function getOriginalTargetValue(e, t, n, r) { switch (getAnimationType(e, t)) { case "transform" : return getTransformValue(e, t, r, n); case "css" : return getCSSValue(e, t, n); case "attribute" : return getAttribute(e, t); default: return e[t] || 0 } } function getRelativeValue(e, t) { var n=operatorRegex.exec(e); if (!n) return e; var r=getUnit(e) || 0, a=parseFloat(t), i=parseFloat(e.replace(n[0], "" )); switch (n[0][0]) { case "+" : return a + i + r; case "-" : return a - i + r; case "*" : return a * i + r } } function validateValue(e, t) { if (is.col(e)) return colorToRgb(e); var n=getUnit(e), r=n ? e.substr(0, e.length - n.length) : e; return t && !whitespaceRegex.test(e) ? r + t : r } function getDistance(e, t) { return Math.sqrt(Math.pow(t.x - e.x, 2) + Math.pow(t.y - e.y, 2)) } function getCircleLength(e) { return 2 * Math.PI * getAttribute(e, "r" ) } function getRectLength(e) { return 2 * getAttribute(e, "width" ) + 2 * getAttribute(e, "height" ) } function getLineLength(e) { return getDistance({ x: getAttribute(e, "x1" ), y: getAttribute(e, "y1" ) }, { x: getAttribute(e, "x2" ), y: getAttribute(e, "y2" ) }) } function getPolylineLength(e) { for (var t, n=e.points, r=0, a=0; a < n.numberOfItems; a++) { var i=n.getItem(a); a> 0 && (r += getDistance(t, i)), t = i
}
return r
}
function getPolygonLength(e) {
var t = e.points;
return getPolylineLength(e) + getDistance(t.getItem(t.numberOfItems - 1), t.getItem(0))
}
function getTotalLength(e) {
if (e.getTotalLength) return e.getTotalLength();
switch (e.tagName.toLowerCase()) {
case "circle":
return getCircleLength(e);
case "rect":
return getRectLength(e);
case "line":
return getLineLength(e);
case "polyline":
return getPolylineLength(e);
case "polygon":
return getPolygonLength(e)
}
}
function setDashoffset(e) {
var t = getTotalLength(e);
return e.setAttribute("stroke-dasharray", t), t
}
function getParentSvgEl(e) {
for (var t = e.parentNode; is.svg(t) && (t = t.parentNode, is.svg(t.parentNode)););
return t
}
function getParentSvg(e, t) {
var n = t || {},
r = n.el || getParentSvgEl(e),
a = r.getBoundingClientRect(),
i = getAttribute(r, "viewBox"),
s = a.width,
o = a.height,
u = n.viewBox || (i ? i.split(" ") : [0, 0, s, o]);
return {
el: r,
viewBox: u,
x: u[0] / 1,
y: u[1] / 1,
w: s / u[2],
h: o / u[3]
}
}
function getPath(e, t) {
var n = is.str(e) ? selectString(e)[0] : e,
r = t || 100;
return function(e) {
return {
property: e,
el: n,
svg: getParentSvg(n),
totalLength: getTotalLength(n) * (r / 100)
}
}
}
function getPathProgress(e, t) {
function n(n) {
void 0 === n && (n = 0);
var r = t + n >= 1 ? t + n : 0;
return e.el.getPointAtLength(r)
}
var r = getParentSvg(e.el, e.svg),
a = n(),
i = n(-1),
s = n(1);
switch (e.property) {
case "x":
return (a.x - r.x) * r.w;
case "y":
return (a.y - r.y) * r.h;
case "angle":
return 180 * Math.atan2(s.y - i.y, s.x - i.x) / Math.PI
}
}
function decomposeValue(e, t) {
var n = validateValue(is.pth(e) ? e.totalLength : e, t) + "";
return {
original: n,
numbers: n.match(valueRegex) ? n.match(valueRegex).map(Number) : [0],
strings: is.str(e) || t ? n.split(valueRegex) : []
}
}
function parseTargets(e) {
return filterArray(e ? flattenArray(is.arr(e) ? e.map(toArray) : toArray(e)) : [], function(e, t, n) {
return n.indexOf(e) === t
})
}
function getAnimatables(e) {
var t = parseTargets(e);
return t.map(function(e, n) {
return {
target: e,
id: n,
total: t.length,
transforms: {
list: getElementTransforms(e)
}
}
})
}
function normalizePropertyTweens(e, t) {
var n = cloneObject(t);
if (springRegex.test(n.easing) && (n.duration = spring(n.easing)), is.arr(e)) {
var r = e.length;
2 === r && !is.obj(e[0]) ? e = {
value: e
} : is.fnc(t.duration) || (n.duration = t.duration / r)
}
var a = is.arr(e) ? e : [e];
return a.map(function(e, n) {
var r = is.obj(e) && !is.pth(e) ? e : {
value: e
};
return is.und(r.delay) && (r.delay = n ? 0 : t.delay), is.und(r.endDelay) && (r.endDelay = n === a.length - 1 ? t.endDelay : 0), r
}).map(function(e) {
return mergeObjects(e, n)
})
}
function flattenKeyframes(e) {
for (var t = filterArray(flattenArray(e.map(function(e) {
return Object.keys(e)
})), function(e) {
return is.key(e)
}).reduce(function(e, t) {
return e.indexOf(t) < 0 && e.push(t), e }, []), n={}, r=0; r < t.length; r++) ! function(r) { var a=t[r]; n[a]=e.map(function(e) { var t={}; for (var n in e) is.key(n) ? n==a && (t.value=e[n]) : t[n]=e[n]; return t }) }(r); return n } function getProperties(e, t) { var n=[], r=t.keyframes; r && (t=mergeObjects(flattenKeyframes(r), t)); for (var a in t) is.key(a) && n.push({ name: a, tweens: normalizePropertyTweens(t[a], e) }); return n } function normalizeTweenValues(e, t) { var n={}; for (var r in e) { var a=getFunctionValue(e[r], t); is.arr(a) && (a=a.map(function(e) { return getFunctionValue(e, t) }), 1===a.length && (a=a[0])), n[r]=a } return n.duration=parseFloat(n.duration), n.delay=parseFloat(n.delay), n } function normalizeTweens(e, t) { var n; return e.tweens.map(function(r) { var a=normalizeTweenValues(r, t), i=a.value, s=is.arr(i) ? i[1] : i, o=getUnit(s), u=getOriginalTargetValue(t.target, e.name, o, t), c=n ? n.to.original : u, l=is.arr(i) ? i[0] : c, g=getUnit(l) || getUnit(u), f=o || g; return is.und(s) && (s=c), a.from=decomposeValue(l, f), a.to=decomposeValue(getRelativeValue(s, l), f), a.start=n ? n.end : 0, a.end=a.start + a.delay + a.duration + a.endDelay, a.easing=parseEasings(a.easing, a.duration), a.isPath=is.pth(i), a.isColor=is.col(a.from.original), a.isColor && (a.round=1), n=a, a }) } function setTargetsValue(e, t) { for (var n=getAnimatables(e), r=0, a=n.length; r < a; r++) { var i=n[r]; for (var s in t) { var o=getFunctionValue(t[s], i), u=i.target, c=getUnit(o), l=getOriginalTargetValue(u, s, c, i), g=c || getUnit(l), f=getRelativeValue(validateValue(o, g), l), p=getAnimationType(u, s); setProgressValue[p](u, s, f, i.transforms, !0) } } } function createAnimation(e, t) { var n=getAnimationType(e.target, t.name); if (n) { var r=normalizeTweens(t, e), a=r[r.length - 1]; return { type: n, property: t.name, animatable: e, tweens: r, duration: a.end, delay: r[0].delay, endDelay: a.endDelay } } } function getAnimations(e, t) { return filterArray(flattenArray(e.map(function(e) { return t.map(function(t) { return createAnimation(e, t) }) })), function(e) { return !is.und(e) }) } function getInstanceTimings(e, t) { var n=e.length, r=function(e) { return e.timelineOffset ? e.timelineOffset : 0 }, a={}; return a.duration=n ? Math.max.apply(Math, e.map(function(e) { return r(e) + e.duration })) : t.duration, a.delay=n ? Math.min.apply(Math, e.map(function(e) { return r(e) + e.delay })) : t.delay, a.endDelay=n ? a.duration - Math.max.apply(Math, e.map(function(e) { return r(e) + e.duration - e.endDelay })) : t.endDelay, a } function createNewInstance(e) { var t=replaceObjectProps(defaultInstanceSettings, e), n=replaceObjectProps(defaultTweenSettings, e), r=getProperties(n, e), a=getAnimatables(e.targets), i=getAnimations(a, r), s=getInstanceTimings(i, n), o=instanceID; return instanceID++, mergeObjects(t, { id: o, children: [], animatables: a, animations: i, duration: s.duration, delay: s.delay, endDelay: s.endDelay }) } function handleVisibilityChange() { if (document.hidden) { for (var e=0, t=activeInstances.length; e < t; e++) activeInstance[e].pause(); pausedInstances=activeInstances.slice(0), activeInstances=[] } else for (var n=0, r=pausedInstances.length; n < r; n++) pausedInstances[n].play() } function anime(e) { function t() { return window.Promise && new Promise(function(e) { return v=e }) } function n() { y.reversed=!y.reversed; for (var e=0, t=g.length; e < t; e++) g[e].reversed=y.reversed } function r(e) { return y.reversed ? y.duration - e : e } function a() { f=0, p=r(y.currentTime) * (1 / anime.speed) } function i(e, t) { t && t.seek(e - t.timelineOffset) } function s(e) { if (y.reversePlayback) for (var t=d; t--;) i(e, g[t]); else for (var n=0; n < d; n++) i(e, g[n]) } function o(e) { for (var t=0, n=y.animations, r=n.length; t < r;) { var a=n[t], i=a.animatable, s=a.tweens, o=s.length - 1, u=s[o]; o && (u=filterArray(s, function(t) { return e < t.end })[0] || u); for (var c=minMax(e - u.start - u.delay, 0, u.duration) / u.duration, l=isNaN(c) ? 1 : u.easing(c), g=u.to.strings, f=u.round, p=[], m=u.to.numbers.length, d=void 0, v=0; v < m; v++) { var h=void 0, b=u.to.numbers[v], x=u.from.numbers[v] || 0; h=u.isPath ? getPathProgress(u.value, l * b) : x + l * (b - x), f && (u.isColor && v> 2 || (h = Math.round(h * f) / f)), p.push(h)
}
var T = g.length;
if (T) {
d = g[0];
for (var A = 0; A < T; A++) { var R=(g[A], g[A + 1]), P=p[A]; isNaN(P) || (d +=R ? P + R : P + " " ) } } else d=p[0]; setProgressValue[a.type](i.target, a.property, d, i.transforms), a.currentValue=d, t++ } } function u(e) { y[e] && !y.passThrough && y[e](y) } function c() { y.remaining && !0 !==y.remaining && y.remaining-- } function l(e) { var a=y.duration, i=y.delay, l=a - y.endDelay, d=r(e); y.progress=minMax(d / a * 100, 0, 100), y.reversePlayback=d < y.currentTime, g && s(d), !y.began && y.currentTime> 0 && (y.began = !0, u("begin"), u("loopBegin")), d <= i && 0 !==y.currentTime && o(0), (d>= l && y.currentTime !== a || !a) && o(a), d > i && d < l ? (y.changeBegan || (y.changeBegan=!0, y.changeCompleted=!1, u("changeBegin")), u("change"), o(d)) : y.changeBegan && (y.changeCompleted=!0, y.changeBegan=!1, u("changeComplete")), y.currentTime=minMax(d, 0, a), y.began && u("update"), e>= a && (p = 0, c(), y.remaining ? (f = m, u("loopComplete"), u("loopBegin"), "alternate" === y.direction && n()) : (y.paused = !0, y.completed || (y.completed = !0, u("loopComplete"), u("complete"), "Promise" in window && (v(), h = t()))))
}
void 0 === e && (e = {});
var g, f = 0,
p = 0,
m = 0,
d = 0,
v = null,
h = t(),
y = createNewInstance(e);
return y.reset = function() {
var e = y.direction;
y.passThrough = !1, y.currentTime = 0, y.progress = 0, y.paused = !0, y.began = !1, y.changeBegan = !1, y.completed = !1, y.changeCompleted = !1, y.reversePlayback = !1, y.reversed = "reverse" === e, y.remaining = y.loop, g = y.children, d = g.length;
for (var t = d; t--;) y.children[t].reset();
(y.reversed && !0 !== y.loop || "alternate" === e && 1 === y.loop) && y.remaining++, o(0)
}, y.set = function(e, t) {
return setTargetsValue(e, t), y
}, y.tick = function(e) {
m = e, f || (f = m), l((m + (p - f)) * anime.speed)
}, y.seek = function(e) {
l(r(e))
}, y.pause = function() {
y.paused = !0, a()
}, y.play = function() {
y.paused && (y.paused = !1, activeInstances.push(y), a(), raf || engine())
}, y.reverse = function() {
n(), a()
}, y.restart = function() {
y.reset(), y.play()
}, y.finished = h, y.reset(), y.autoplay && y.play(), y
}
function removeTargetsFromAnimations(e, t) {
for (var n = t.length; n--;) arrayContains(e, t[n].animatable.target) && t.splice(n, 1)
}
function removeTargets(e) {
for (var t = parseTargets(e), n = activeInstances.length; n--;) {
var r = activeInstances[n],
a = r.animations,
i = r.children;
removeTargetsFromAnimations(t, a);
for (var s = i.length; s--;) {
var o = i[s],
u = o.animations;
removeTargetsFromAnimations(t, u), u.length || o.children.length || i.splice(s, 1)
}
a.length || i.length || r.pause()
}
}
function stagger(e, t) {
void 0 === t && (t = {});
var n = t.direction || "normal",
r = t.easing ? parseEasings(t.easing) : null,
a = t.grid,
i = t.axis,
s = t.from || 0,
o = "first" === s,
u = "center" === s,
c = "last" === s,
l = is.arr(e),
g = l ? parseFloat(e[0]) : parseFloat(e),
f = l ? parseFloat(e[1]) : 0,
p = getUnit(l ? e[1] : e) || 0,
m = t.start || 0 + (l ? g : 0),
d = [],
v = 0;
return function(e, t, h) {
if (o && (s = 0), u && (s = (h - 1) / 2), c && (s = h - 1), !d.length) {
for (var y = 0; y < h; y++) { if (a) { var b=u ? (a[0] - 1) / 2 : s % a[0], x=u ? (a[1] - 1) / 2 : Math.floor(s / a[0]), T=y % a[0], A=Math.floor(y / a[0]), R=b - T, P=x - A, w=Math.sqrt(R * R + P * P); "x"===i && (w=-R), "y"===i && (w=-P), d.push(w) } else d.push(Math.abs(s - y)); v=Math.max.apply(Math, d) } r && (d=d.map(function(e) { return r(e / v) * v })), "reverse"===n && (d=d.map(function(e) { return i ? e < 0 ? -1 * e : -e : Math.abs(v - e) })) } return m + (l ? (f - g) / v : g) * (Math.round(100 * d[t]) / 100) + p } } function timeline(e) { void 0===e && (e={}); var t=anime(e); return t.duration=0, t.add=function(n, r) { function a(e) { e.passThrough=!0 } var i=activeInstances.indexOf(t), s=t.children; i> -1 && activeInstances.splice(i, 1);
for (var o = 0; o < s.length; o++) a(s[o]); var u=mergeObjects(n, replaceObjectProps(defaultTweenSettings, e)); u.targets=u.targets || e.targets; var c=t.duration; u.autoplay=!1, u.direction=t.direction, u.timelineOffset=is.und(r) ? c : getRelativeValue(r, c), a(t), t.seek(u.timelineOffset); var l=anime(u); a(l), s.push(l); var g=getInstanceTimings(s, e); return t.delay=g.delay, t.endDelay=g.endDelay, t.duration=g.duration, t.seek(0), t.reset(), t.autoplay && t.play(), t }, t } var defaultInstanceSettings={ update: null, begin: null, loopBegin: null, changeBegin: null, change: null, changeComplete: null, loopComplete: null, complete: null, loop: 1, direction: "normal" , autoplay: !0, timelineOffset: 0 }, defaultTweenSettings={ duration: 1e3, delay: 0, endDelay: 0, easing: "easeOutElastic(1, .5)" , round: 0 }, validTransforms=["translateX", "translateY" , "translateZ" , "rotate" , "rotateX" , "rotateY" , "rotateZ" , "scale" , "scaleX" , "scaleY" , "scaleZ" , "skew" , "skewX" , "skewY" , "perspective" ], cache={ CSS: {}, springs: {} }, hexRegex=/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i, rgbPrefixRegex=/^rgb/, hslRegex=/^hsl/, is={ arr: function(e) { return Array.isArray(e) }, obj: function(e) { return stringContains(Object.prototype.toString.call(e), "Object" ) }, pth: function(e) { return is.obj(e) && e.hasOwnProperty("totalLength") }, svg: function(e) { return e instanceof SVGElement }, inp: function(e) { return e instanceof HTMLInputElement }, dom: function(e) { return e.nodeType || is.svg(e) }, str: function(e) { return "string"==typeof e }, fnc: function(e) { return "function"==typeof e }, und: function(e) { return void 0===e }, hex: function(e) { return hexRegex.test(e) }, rgb: function(e) { return rgbPrefixRegex.test(e) }, hsl: function(e) { return hslRegex.test(e) }, col: function(e) { return is.hex(e) || is.rgb(e) || is.hsl(e) }, key: function(e) { return !defaultInstanceSettings.hasOwnProperty(e) && !defaultTweenSettings.hasOwnProperty(e) && "targets" !==e && "keyframes" !==e } }, easingFunctionRegex=/\(([^)]+)\)/, bezier=function() { function e(e, t) { return 1 - 3 * t + 3 * e } function t(e, t) { return 3 * t - 6 * e } function n(e) { return 3 * e } function r(r, a, i) { return ((e(a, i) * r + t(a, i)) * r + n(a)) * r } function a(r, a, i) { return 3 * e(a, i) * r * r + 2 * t(a, i) * r + n(a) } function i(e, t, n, a, i) { var s, o, u=0; do { o=t + (n - t) / 2, s=r(o, a, i) - e, s> 0 ? n = o : t = o
} while (Math.abs(s) > 1e-7 && ++u < 10); return o } function s(e, t, n, i) { for (var s=0; s < 4; ++s) { var o=a(t, n, i); if (0===o) return t; t -=(r(t, n, i) - e) / o } return t } function o(e, t, n, o) { function l(t) { for (var r=0, o=1, l=u - 1; o !==l && g[o] <=t; ++o) r +=c; --o; var f=(t - g[o]) / (g[o + 1] - g[o]), p=r + f * c, m=a(p, e, n); return m>= .001 ? s(t, p, e, n) : 0 === m ? p : i(t, r, r + c, e, n)
}
if (0 <= e && e <=1 && 0 <=n && n <=1) { var g=new Float32Array(u); if (e !==t || n !==o) for (var f=0; f < u; ++f) g[f]=r(f * c, e, n); return function(a) { return e===t && n===o ? a : 0===a || 1===a ? a : r(l(a), t, o) } } } var u=11, c=1 / (u - 1); return o }(), penner=function() { var e=["Quad", "Cubic" , "Quart" , "Quint" , "Sine" , "Expo" , "Circ" , "Back" , "Elastic" ], t={ In: [ [.55, .085, .68, .53], [.55, .055, .675, .19], [.895, .03, .685, .22], [.755, .05, .855, .06], [.47, 0, .745, .715], [.95, .05, .795, .035], [.6, .04, .98, .335], [.6, -.28, .735, .045], elastic ], Out: [ [.25, .46, .45, .94], [.215, .61, .355, 1], [.165, .84, .44, 1], [.23, 1, .32, 1], [.39, .575, .565, 1], [.19, 1, .22, 1], [.075, .82, .165, 1], [.175, .885, .32, 1.275], function(e, t) { return function(n) { return 1 - elastic(e, t)(1 - n) } } ], InOut: [ [.455, .03, .515, .955], [.645, .045, .355, 1], [.77, 0, .175, 1], [.86, 0, .07, 1], [.445, .05, .55, .95], [1, 0, 0, 1], [.785, .135, .15, .86], [.68, -.55, .265, 1.55], function(e, t) { return function(n) { return n < .5 ? elastic(e, t)(2 * n) / 2 : 1 - elastic(e, t)(-2 * n + 2) / 2 } } ] }, n={ linear: [.25, .25, .75, .75] }; for (var r in t) for (var a=0, i=t[r].length; a < i; a++) n["ease" + r + e[a]]=t[r][a]; return n }(), auxArrayFilter=[], rgbRegex=/rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g, hexToRgbaHexRegex=/^#?([a-f\d])([a-f\d])([a-f\d])$/i, hexToRgbaRgbRegex=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i, hslToRgbaHsl1Regex=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g, hslToRgbaHsl2Regex=/hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g, unitRegex=/([\+\-]?[0-9#\.]+)(%|px|pt|em|rem|in|cm|mm|ex|ch|pc|vw|vh|vmin|vmax|deg|rad|turn)?$/, transformRegex=/(\w+)\(([^)]*)\)/g, operatorRegex=/^(\*=|\+=|-=)/, whitespaceRegex=/\s/g, valueRegex=/-?\d*\.?\d+/g, springRegex=/^spring/, setProgressValue={ css: function(e, t, n) { return e.style[t]=n }, attribute: function(e, t, n) { return e.setAttribute(t, n) }, object: function(e, t, n) { return e[t]=n }, transform: function(e, t, n, r, a) { if (r.list.set(t, n), t===r.last || a) { var i="" ; r.list.forEach(function(e, t) { i +=t + "(" + e + ") " }), e.style.transform=i } } }, instanceID=0, activeInstances=[], pausedInstances=[], raf, engine=function() { function e() { raf=requestAnimationFrame(t) } function t(t) { var n=activeInstances.length; if (n) { for (var r=0; r < n;) { var a=activeInstances[r]; if (a.paused) { var i=activeInstances.indexOf(a); i> -1 && (activeInstances.splice(i, 1), n = activeInstances.length)
} else a.tick(t);
r++
}
e()
} else raf = cancelAnimationFrame(raf)
}
return e
}();
document.addEventListener("visibilitychange", handleVisibilityChange), anime.version = "3.0.0", anime.speed = 1, anime.running = activeInstances, anime.remove = removeTargets, anime.get = getOriginalTargetValue, anime.set = setTargetsValue, anime.convertPx = convertPxToUnit, anime.path = getPath, anime.setDashoffset = setDashoffset, anime.stagger = stagger, anime.timeline = timeline, anime.easing = parseEasings, anime.penner = penner, anime.random = function(e, t) {
return Math.floor(Math.random() * (t - e + 1)) + e
}, module.exports = anime;
}, {}],
37: [function(_dereq_, module, exports) {
! function(e, t) {
"object" == typeof exports && "undefined" != typeof module ? t(exports) : "function" == typeof define && define.amd ? define(["exports"], t) : (e = e || self, t(e.THREE = {}))
}(this, function(e) {
"use strict";
function t() {}
function n(e, t) {
this.x = e || 0, this.y = t || 0
}
function r(e, t, n, r) {
this._x = e || 0, this._y = t || 0, this._z = n || 0, this._w = void 0 !== r ? r : 1
}
function i(e, t, n) {
this.x = e || 0, this.y = t || 0, this.z = n || 0
}
function a() {
this.elements = [1, 0, 0, 0, 1, 0, 0, 0, 1], arguments.length > 0 && console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")
}
function o(e, t, r, i, s, c, l, h, u, p) {
Object.defineProperty(this, "id", {
value: ml++
}), this.uuid = ll.generateUUID(), this.name = "", this.image = void 0 !== e ? e : o.DEFAULT_IMAGE, this.mipmaps = [], this.mapping = void 0 !== t ? t : o.DEFAULT_MAPPING, this.wrapS = void 0 !== r ? r : qs, this.wrapT = void 0 !== i ? i : qs, this.magFilter = void 0 !== s ? s : Qs, this.minFilter = void 0 !== c ? c : $s, this.anisotropy = void 0 !== u ? u : 1, this.format = void 0 !== l ? l : fc, this.type = void 0 !== h ? h : ec, this.offset = new n(0, 0), this.repeat = new n(1, 1), this.center = new n(0, 0), this.rotation = 0, this.matrixAutoUpdate = !0, this.matrix = new a, this.generateMipmaps = !0, this.premultiplyAlpha = !1, this.flipY = !0, this.unpackAlignment = 4, this.encoding = void 0 !== p ? p : qc, this.version = 0, this.onUpdate = null
}
function s(e, t, n, r) {
this.x = e || 0, this.y = t || 0, this.z = n || 0, this.w = void 0 !== r ? r : 1
}
function c(e, t, n) {
this.width = e, this.height = t, this.scissor = new s(0, 0, e, t), this.scissorTest = !1, this.viewport = new s(0, 0, e, t), n = n || {}, this.texture = new o(void 0, void 0, n.wrapS, n.wrapT, n.magFilter, n.minFilter, n.format, n.type, n.anisotropy, n.encoding), this.texture.image = {}, this.texture.image.width = e, this.texture.image.height = t, this.texture.generateMipmaps = void 0 !== n.generateMipmaps && n.generateMipmaps, this.texture.minFilter = void 0 !== n.minFilter ? n.minFilter : Qs, this.depthBuffer = void 0 === n.depthBuffer || n.depthBuffer, this.stencilBuffer = void 0 === n.stencilBuffer || n.stencilBuffer, this.depthTexture = void 0 !== n.depthTexture ? n.depthTexture : null
}
function l(e, t, n) {
c.call(this, e, t, n), this.samples = 4
}
function h() {
this.elements = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], arguments.length > 0 && console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")
}
function u(e, t, n, r) {
this._x = e || 0, this._y = t || 0, this._z = n || 0, this._order = r || u.DefaultOrder
}
function p() {
this.mask = 1
}
function d() {
function e() {
s.setFromEuler(o, !1)
}
function t() {
o.setFromQuaternion(s, void 0, !1)
}
Object.defineProperty(this, "id", {
value: Tl++
}), this.uuid = ll.generateUUID(), this.name = "", this.type = "Object3D", this.parent = null, this.children = [], this.up = d.DefaultUp.clone();
var n = new i,
o = new u,
s = new r,
c = new i(1, 1, 1);
o._onChange(e), s._onChange(t), Object.defineProperties(this, {
position: {
configurable: !0,
enumerable: !0,
value: n
},
rotation: {
configurable: !0,
enumerable: !0,
value: o
},
quaternion: {
configurable: !0,
enumerable: !0,
value: s
},
scale: {
configurable: !0,
enumerable: !0,
value: c
},
modelViewMatrix: {
value: new h
},
normalMatrix: {
value: new a
}
}), this.matrix = new h, this.matrixWorld = new h, this.matrixAutoUpdate = d.DefaultMatrixAutoUpdate, this.matrixWorldNeedsUpdate = !1, this.layers = new p, this.visible = !0, this.castShadow = !1, this.receiveShadow = !1, this.frustumCulled = !0, this.renderOrder = 0, this.userData = {}
}
function f() {
d.call(this), this.type = "Scene", this.background = null, this.fog = null, this.overrideMaterial = null, this.autoUpdate = !0, "undefined" != typeof __THREE_DEVTOOLS__ && __THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe", {
detail: this
}))
}
function m(e, t) {
this.min = void 0 !== e ? e : new i(1 / 0, 1 / 0, 1 / 0), this.max = void 0 !== t ? t : new i(-1 / 0, -1 / 0, -1 / 0)
}
function v(e, t, n, r, i) {
var a, o;
for (a = 0, o = e.length - 3; a <= o; a +=3) { Jl.fromArray(e, a); var s=i.x * Math.abs(Jl.x) + i.y * Math.abs(Jl.y) + i.z * Math.abs(Jl.z), c=t.dot(Jl), l=n.dot(Jl), h=r.dot(Jl); if (Math.max(-Math.max(c, l, h), Math.min(c, l, h))> s) return !1
}
return !0
}
function g(e, t) {
this.center = void 0 !== e ? e : new i, this.radius = void 0 !== t ? t : 0
}
function y(e, t) {
this.origin = void 0 !== e ? e : new i, this.direction = void 0 !== t ? t : new i(0, 0, -1)
}
function x(e, t) {
this.normal = void 0 !== e ? e : new i(1, 0, 0), this.constant = void 0 !== t ? t : 0
}
function b(e, t, n) {
this.a = void 0 !== e ? e : new i, this.b = void 0 !== t ? t : new i, this.c = void 0 !== n ? n : new i
}
function w(e, t, n) {
return void 0 === t && void 0 === n ? this.set(e) : this.setRGB(e, t, n)
}
function _(e, t, n) {
return n < 0 && (n +=1), n> 1 && (n -= 1), n < 1 / 6 ? e + 6 * (t - e) * n : n < .5 ? t : n < 2 / 3 ? e + 6 * (t - e) * (2 / 3 - n) : e } function M(e) { return e < .04045 ? .0773993808 * e : Math.pow(.9478672986 * e + .0521327014, 2.4) } function S(e) { return e < .0031308 ? 12.92 * e : 1.055 * Math.pow(e, .41666) - .055 } function T(e, t, n, r, a, o) { this.a=e, this.b=t, this.c=n, this.normal=r && r.isVector3 ? r : new i, this.vertexNormals=Array.isArray(r) ? r : [], this.color=a && a.isColor ? a : new w, this.vertexColors=Array.isArray(a) ? a : [], this.materialIndex=void 0 !==o ? o : 0 } function E() { Object.defineProperty(this, "id" , { value: wh++ }), this.uuid=ll.generateUUID(), this.name="" , this.type="Material" , this.fog=!0, this.blending=es, this.side=Xo, this.flatShading=!1, this.vertexTangents=!1, this.vertexColors=Jo, this.opacity=1, this.transparent=!1, this.blendSrc=fs, this.blendDst=ms, this.blendEquation=as, this.blendSrcAlpha=null, this.blendDstAlpha=null, this.blendEquationAlpha=null, this.depthFunc=Ss, this.depthTest=!0, this.depthWrite=!0, this.stencilWriteMask=255, this.stencilFunc=al, this.stencilRef=0, this.stencilFuncMask=255, this.stencilFail=il, this.stencilZFail=il, this.stencilZPass=il, this.stencilWrite=!1, this.clippingPlanes=null, this.clipIntersection=!1, this.clipShadows=!1, this.shadowSide=null, this.colorWrite=!0, this.precision=null, this.polygonOffset=!1, this.polygonOffsetFactor=0, this.polygonOffsetUnits=0, this.dithering=!1, this.alphaTest=0, this.premultipliedAlpha=!1, this.visible=!0, this.toneMapped=!0, this.userData={}, this.version=0 } function A(e) { E.call(this), this.type="MeshBasicMaterial" , this.color=new w(16777215), this.map=null, this.lightMap=null, this.lightMapIntensity=1, this.aoMap=null, this.aoMapIntensity=1, this.specularMap=null, this.alphaMap=null, this.envMap=null, this.combine=Rs, this.reflectivity=1, this.refractionRatio=.98, this.wireframe=!1, this.wireframeLinewidth=1, this.wireframeLinecap="round" , this.wireframeLinejoin="round" , this.skinning=!1, this.morphTargets=!1, this.setValues(e) } function L(e, t, n) { if (Array.isArray(e)) throw new TypeError("THREE.BufferAttribute: array should be a Typed Array."); this.name="" , this.array=e, this.itemSize=t, this.count=void 0 !==e ? e.length / t : 0, this.normalized=!0===n, this.usage=ol, this.updateRange={ offset: 0, count: -1 }, this.version=0 } function R(e, t, n) { L.call(this, new Int8Array(e), t, n) } function P(e, t, n) { L.call(this, new Uint8Array(e), t, n) } function C(e, t, n) { L.call(this, new Uint8ClampedArray(e), t, n) } function O(e, t, n) { L.call(this, new Int16Array(e), t, n) } function D(e, t, n) { L.call(this, new Uint16Array(e), t, n) } function I(e, t, n) { L.call(this, new Int32Array(e), t, n) } function N(e, t, n) { L.call(this, new Uint32Array(e), t, n) } function z(e, t, n) { L.call(this, new Float32Array(e), t, n) } function B(e, t, n) { L.call(this, new Float64Array(e), t, n) } function U() { this.vertices=[], this.normals=[], this.colors=[], this.uvs=[], this.uvs2=[], this.groups=[], this.morphTargets={}, this.skinWeights=[], this.skinIndices=[], this.boundingBox=null, this.boundingSphere=null, this.verticesNeedUpdate=!1, this.normalsNeedUpdate=!1, this.colorsNeedUpdate=!1, this.uvsNeedUpdate=!1, this.groupsNeedUpdate=!1 } function F(e) { if (0===e.length) return -1 / 0; for (var t=e[0], n=1, r=e.length; n < r; ++n) e[n]> t && (t = e[n]);
return t
}
function G() {
Object.defineProperty(this, "id", {
value: Mh += 2
}), this.uuid = ll.generateUUID(), this.name = "", this.type = "BufferGeometry", this.index = null, this.attributes = {}, this.morphAttributes = {}, this.morphTargetsRelative = !1, this.groups = [], this.boundingBox = null, this.boundingSphere = null, this.drawRange = {
start: 0,
count: 1 / 0
}, this.userData = {}
}
function H(e, t) {
d.call(this), this.type = "Mesh", this.geometry = void 0 !== e ? e : new G, this.material = void 0 !== t ? t : new A({
color: 16777215 * Math.random()
}), this.updateMorphTargets()
}
function V(e, t, n, r, i, a, o, s) {
if (null === (t.side === Yo ? r.intersectTriangle(o, a, i, !0, s) : r.intersectTriangle(i, a, o, t.side !== Zo, s))) return null;
qh.copy(s), qh.applyMatrix4(e.matrixWorld);
var c = n.ray.origin.distanceTo(qh);
return c < n.near || c> n.far ? null : {
distance: c,
point: qh.clone(),
object: e
}
}
function j(e, t, r, i, a, o, s, c, l, h, u, p) {
Dh.fromBufferAttribute(a, h), Ih.fromBufferAttribute(a, u), Nh.fromBufferAttribute(a, p);
var d = e.morphTargetInfluences;
if (t.morphTargets && o && d) {
Fh.set(0, 0, 0), Gh.set(0, 0, 0), Hh.set(0, 0, 0);
for (var f = 0, m = o.length; f < m; f++) { var v=d[f], g=o[f]; 0 !==v && (zh.fromBufferAttribute(g, h), Bh.fromBufferAttribute(g, u), Uh.fromBufferAttribute(g, p), s ? (Fh.addScaledVector(zh, v), Gh.addScaledVector(Bh, v), Hh.addScaledVector(Uh, v)) : (Fh.addScaledVector(zh.sub(Dh), v), Gh.addScaledVector(Bh.sub(Ih), v), Hh.addScaledVector(Uh.sub(Nh), v))) } Dh.add(Fh), Ih.add(Gh), Nh.add(Hh) } var y=V(e, t, r, i, Dh, Ih, Nh, Wh); if (y) { c && (Vh.fromBufferAttribute(c, h), jh.fromBufferAttribute(c, u), kh.fromBufferAttribute(c, p), y.uv=b.getUV(Wh, Dh, Ih, Nh, Vh, jh, kh, new n)), l && (Vh.fromBufferAttribute(l, h), jh.fromBufferAttribute(l, u), kh.fromBufferAttribute(l, p), y.uv2=b.getUV(Wh, Dh, Ih, Nh, Vh, jh, kh, new n)); var x=new T(h, u, p); b.getNormal(Dh, Ih, Nh, x.normal), y.face=x } return y } function k() { Object.defineProperty(this, "id" , { value: Xh +=2 }), this.uuid=ll.generateUUID(), this.name="" , this.type="Geometry" , this.vertices=[], this.colors=[], this.faces=[], this.faceVertexUvs=[ [] ], this.morphTargets=[], this.morphNormals=[], this.skinWeights=[], this.skinIndices=[], this.lineDistances=[], this.boundingBox=null, this.boundingSphere=null, this.elementsNeedUpdate=!1, this.verticesNeedUpdate=!1, this.uvsNeedUpdate=!1, this.normalsNeedUpdate=!1, this.colorsNeedUpdate=!1, this.lineDistancesNeedUpdate=!1, this.groupsNeedUpdate=!1 } function W(e) { var t={}; for (var n in e) { t[n]={}; for (var r in e[n]) { var i=e[n][r]; i && (i.isColor || i.isMatrix3 || i.isMatrix4 || i.isVector2 || i.isVector3 || i.isVector4 || i.isTexture) ? t[n][r]=i.clone() : Array.isArray(i) ? t[n][r]=i.slice() : t[n][r]=i } } return t } function q(e) { for (var t={}, n=0; n < e.length; n++) { var r=W(e[n]); for (var i in r) t[i]=r[i] } return t } function X(e) { E.call(this), this.type="ShaderMaterial" , this.defines={}, this.uniforms={}, this.vertexShader=eu, this.fragmentShader=tu, this.linewidth=1, this.wireframe=!1, this.wireframeLinewidth=1, this.fog=!1, this.lights=!1, this.clipping=!1, this.skinning=!1, this.morphTargets=!1, this.morphNormals=!1, this.extensions={ derivatives: !1, fragDepth: !1, drawBuffers: !1, shaderTextureLOD: !1 }, this.defaultAttributeValues={ color: [1, 1, 1], uv: [0, 0], uv2: [0, 0] }, this.index0AttributeName=void 0, this.uniformsNeedUpdate=!1, void 0 !==e && (void 0 !==e.attributes && console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."), this.setValues(e)) } function Y() { d.call(this), this.type="Camera" , this.matrixWorldInverse=new h, this.projectionMatrix=new h, this.projectionMatrixInverse=new h } function Z(e, t, n, r) { Y.call(this), this.type="PerspectiveCamera" , this.fov=void 0 !==e ? e : 50, this.zoom=1, this.near=void 0 !==n ? n : .1, this.far=void 0 !==r ? r : 2e3, this.focus=10, this.aspect=void 0 !==t ? t : 1, this.view=null, this.filmGauge=35, this.filmOffset=0, this.updateProjectionMatrix() } function J(e, t, n, r) { d.call(this), this.type="CubeCamera" ; var a=new Z(nu, ru, e, t); a.up.set(0, -1, 0), a.lookAt(new i(1, 0, 0)), this.add(a); var o=new Z(nu, ru, e, t); o.up.set(0, -1, 0), o.lookAt(new i(-1, 0, 0)), this.add(o); var s=new Z(nu, ru, e, t); s.up.set(0, 0, 1), s.lookAt(new i(0, 1, 0)), this.add(s); var c=new Z(nu, ru, e, t); c.up.set(0, 0, -1), c.lookAt(new i(0, -1, 0)), this.add(c); var l=new Z(nu, ru, e, t); l.up.set(0, -1, 0), l.lookAt(new i(0, 0, 1)), this.add(l); var h=new Z(nu, ru, e, t); h.up.set(0, -1, 0), h.lookAt(new i(0, 0, -1)), this.add(h), r=r || { format: dc, magFilter: Qs, minFilter: Qs }, this.renderTarget=new Q(n, n, r), this.renderTarget.texture.name="CubeCamera" , this.update=function(e, t) { null===this.parent && this.updateMatrixWorld(); var n=e.getRenderTarget(), r=this.renderTarget, i=r.texture.generateMipmaps; r.texture.generateMipmaps=!1, e.setRenderTarget(r, 0), e.render(t, a), e.setRenderTarget(r, 1), e.render(t, o), e.setRenderTarget(r, 2), e.render(t, s), e.setRenderTarget(r, 3), e.render(t, c), e.setRenderTarget(r, 4), e.render(t, l), r.texture.generateMipmaps=i, e.setRenderTarget(r, 5), e.render(t, h), e.setRenderTarget(n) }, this.clear=function(e, t, n, r) { for (var i=e.getRenderTarget(), a=this.renderTarget, o=0; o < 6; o++) e.setRenderTarget(a, o), e.clear(t, n, r); e.setRenderTarget(i) } } function Q(e, t, n) { c.call(this, e, t, n) } function K(e, t, n, r, i, a, s, c, l, h, u, p) { o.call(this, null, a, s, c, l, h, r, i, u, p), this.image={ data: e || null, width: t || 1, height: n || 1 }, this.magFilter=void 0 !==l ? l : Ys, this.minFilter=void 0 !==h ? h : Ys, this.generateMipmaps=!1, this.flipY=!1, this.unpackAlignment=1, this.needsUpdate=!0 } function $(e, t, n, r, i, a) { this.planes=[void 0 !==e ? e : new x, void 0 !==t ? t : new x, void 0 !==n ? n : new x, void 0 !==r ? r : new x, void 0 !==i ? i : new x, void 0 !==a ? a : new x] } function ee() { function e(i, a) { !1 !==n && (r(i, a), t.requestAnimationFrame(e)) } var t=null, n=!1, r=null; return { start: function() { !0 !==n && null !==r && (t.requestAnimationFrame(e), n=!0) }, stop: function() { n=!1 }, setAnimationLoop: function(e) { r=e }, setContext: function(e) { t=e } } } function te(e) { function t(t, n) { var r=t.array, i=t.usage, a=e.createBuffer(); e.bindBuffer(n, a), e.bufferData(n, r, i), t.onUploadCallback(); var o=5126; return r instanceof Float32Array ? o=5126 : r instanceof Float64Array ? console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array.") : r instanceof Uint16Array ? o=5123 : r instanceof Int16Array ? o=5122 : r instanceof Uint32Array ? o=5125 : r instanceof Int32Array ? o=5124 : r instanceof Int8Array ? o=5120 : r instanceof Uint8Array && (o=5121), { buffer: a, type: o, bytesPerElement: r.BYTES_PER_ELEMENT, version: t.version } } function n(t, n, r) { var i=n.array, a=n.updateRange; e.bindBuffer(r, t), -1===a.count ? e.bufferSubData(r, 0, i) : (e.bufferSubData(r, a.offset * i.BYTES_PER_ELEMENT, i.subarray(a.offset, a.offset + a.count)), a.count=-1) } function r(e) { return e.isInterleavedBufferAttribute && (e=e.data), o.get(e) } function i(t) { t.isInterleavedBufferAttribute && (t=t.data); var n=o.get(t); n && (e.deleteBuffer(n.buffer), o.delete(t)) } function a(e, r) { e.isInterleavedBufferAttribute && (e=e.data); var i=o.get(e); void 0===i ? o.set(e, t(e, r)) : i.version < e.version && (n(i.buffer, e, r), i.version=e.version) } var o=new WeakMap; return { get: r, remove: i, update: a } } function ne(e, t, n, r) { k.call(this), this.type="PlaneGeometry" , this.parameters={ width: e, height: t, widthSegments: n, heightSegments: r }, this.fromBufferGeometry(new re(e, t, n, r)), this.mergeVertices() } function re(e, t, n, r) { G.call(this), this.type="PlaneBufferGeometry" , this.parameters={ width: e, height: t, widthSegments: n, heightSegments: r }, e=e || 1, t=t || 1; var i, a, o=e / 2, s=t / 2, c=Math.floor(n) || 1, l=Math.floor(r) || 1, h=c + 1, u=l + 1, p=e / c, d=t / l, f=[], m=[], v=[], g=[]; for (a=0; a < u; a++) { var y=a * d - s; for (i=0; i < h; i++) { var x=i * p - o; m.push(x, -y, 0), v.push(0, 0, 1), g.push(i / c), g.push(1 - a / l) } } for (a=0; a < l; a++) for (i=0; i < c; i++) { var b=i + h * a, w=i + h * (a + 1), _=i + 1 + h * (a + 1), M=i + 1 + h * a; f.push(b, w, M), f.push(w, _, M) } this.setIndex(f), this.setAttribute("position", new z(m, 3)), this.setAttribute("normal", new z(v, 3)), this.setAttribute("uv", new z(g, 2)) } function ie(e, t, n, r) { function i(t, r, i, p) { var d=r.background, f=e.xr, m=f.getSession && f.getSession(); if (m && "additive"===m.environmentBlendMode && (d=null), null===d ? (a(c, l), h=null, u=0) : d && d.isColor && (a(d, 1), p=!0, h=null, u=0), (e.autoClear || p) && e.clear(e.autoClearColor, e.autoClearDepth, e.autoClearStencil), d && (d.isCubeTexture || d.isWebGLRenderTargetCube || d.mapping===js)) { void 0===s && (s=new H(new Kh(1, 1, 1), new X({ type: "BackgroundCubeMaterial" , uniforms: W(cu.cube.uniforms), vertexShader: cu.cube.vertexShader, fragmentShader: cu.cube.fragmentShader, side: Yo, depthTest: !1, depthWrite: !1, fog: !1 })), s.geometry.deleteAttribute("normal"), s.geometry.deleteAttribute("uv"), s.onBeforeRender=function(e, t, n) { this.matrixWorld.copyPosition(n.matrixWorld) }, Object.defineProperty(s.material, "map" , { get: function() { return this.envMap.value } }), n.update(s)); var v=d.isWebGLRenderTargetCube ? d.texture : d; s.material.envMap=v, h===d && u===v.version || (s.material.needsUpdate=!0, h=d, u=v.version), t.unshift(s, s.geometry, s.material, 0, 0, null) } else d && d.isTexture && (void 0===o && (o=new H(new re(2, 2), new X({ type: "BackgroundMaterial" , uniforms: W(cu.background.uniforms), vertexShader: cu.background.vertexShader, fragmentShader: cu.background.fragmentShader, side: Xo, depthTest: !1, depthWrite: !1, fog: !1 })), o.geometry.deleteAttribute("normal"), Object.defineProperty(o.material, "map" , { get: function() { return this.uniforms.t2D.value } }), n.update(o)), o.material.uniforms.t2D.value=d, !0===d.matrixAutoUpdate && d.updateMatrix(), o.material.uniforms.uvTransform.value.copy(d.matrix), h===d && u===d.version || (o.material.needsUpdate=!0, h=d, u=d.version), t.unshift(o, o.geometry, o.material, 0, 0, null)) } function a(e, n) { t.buffers.color.setClear(e.r, e.g, e.b, n, r) } var o, s, c=new w(0), l=0, h=null, u=0; return { getClearColor: function() { return c }, setClearColor: function(e, t) { c.set(e), l=void 0 !==t ? t : 1, a(c, l) }, getClearAlpha: function() { return l }, setClearAlpha: function(e) { l=e, a(c, l) }, render: i } } function ae(e, t, n, r) { function i(e) { s=e } function a(t, r) { e.drawArrays(s, t, r), n.update(r, s) } function o(r, i, a, o) { if (0 !==o) { var l, h; if (c) l=e, h="drawArraysInstanced" ; else if (l=t.get("ANGLE_instanced_arrays"), h="drawArraysInstancedANGLE" , null===l) return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays."); l[h](s, i, a, o), n.update(a, s, o) } } var s, c=r.isWebGL2; this.setMode=i, this.render=a, this.renderInstances=o } function oe(e, t, n) { function r() { if (void 0 !==a) return a; var n=t.get("EXT_texture_filter_anisotropic"); return a=null !==n ? e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT) : 0 } function i(t) { if ("highp"===t) { if (e.getShaderPrecisionFormat(35633, 36338).precision> 0 && e.getShaderPrecisionFormat(35632, 36338).precision > 0) return "highp";
t = "mediump"
}
return "mediump" === t && e.getShaderPrecisionFormat(35633, 36337).precision > 0 && e.getShaderPrecisionFormat(35632, 36337).precision > 0 ? "mediump" : "lowp"
}
var a, o = "undefined" != typeof WebGL2RenderingContext && e instanceof WebGL2RenderingContext || "undefined" != typeof WebGL2ComputeRenderingContext && e instanceof WebGL2ComputeRenderingContext,
s = void 0 !== n.precision ? n.precision : "highp",
c = i(s);
c !== s && (console.warn("THREE.WebGLRenderer:", s, "not supported, using", c, "instead."), s = c);
var l = !0 === n.logarithmicDepthBuffer,
h = e.getParameter(34930),
u = e.getParameter(35660),
p = e.getParameter(3379),
d = e.getParameter(34076),
f = e.getParameter(34921),
m = e.getParameter(36347),
v = e.getParameter(36348),
g = e.getParameter(36349),
y = u > 0,
x = o || !!t.get("OES_texture_float");
return {
isWebGL2: o,
getMaxAnisotropy: r,
getMaxPrecision: i,
precision: s,
logarithmicDepthBuffer: l,
maxTextures: h,
maxVertexTextures: u,
maxTextureSize: p,
maxCubemapSize: d,
maxAttributes: f,
maxVertexUniforms: m,
maxVaryings: v,
maxFragmentUniforms: g,
vertexTextures: y,
floatFragmentTextures: x,
floatVertexTextures: y && x,
maxSamples: o ? e.getParameter(36183) : 0
}
}
function se() {
function e() {
h.value !== r && (h.value = r, h.needsUpdate = i > 0), n.numPlanes = i, n.numIntersection = 0
}
function t(e, t, r, i) {
var a = null !== e ? e.length : 0,
o = null;
if (0 !== a) {
if (o = h.value, !0 !== i || null === o) {
var s = r + 4 * a,
u = t.matrixWorldInverse;
l.getNormalMatrix(u), (null === o || o.length < s) && (o=new Float32Array(s)); for (var p=0, d=r; p !==a; ++p, d +=4) c.copy(e[p]).applyMatrix4(u, l), c.normal.toArray(o, d), o[d + 3]=c.constant } h.value=o, h.needsUpdate=!0 } return n.numPlanes=a, o } var n=this, r=null, i=0, o=!1, s=!1, c=new x, l=new a, h={ value: null, needsUpdate: !1 }; this.uniform=h, this.numPlanes=0, this.numIntersection=0, this.init=function(e, n, a) { var s=0 !==e.length || n || 0 !==i || o; return o=n, r=t(e, a, 0), i=e.length, s }, this.beginShadows=function() { s=!0, t(null) }, this.endShadows=function() { s=!1, e() }, this.setState=function(n, a, c, l, u, p) { if (!o || null===n || 0===n.length || s && !c) s ? t(null) : e(); else { var d=s ? 0 : i, f=4 * d, m=u.clippingState || null; h.value=m, m=t(n, l, f, p); for (var v=0; v !==f; ++v) m[v]=r[v]; u.clippingState=m, this.numIntersection=a ? this.numPlanes : 0, this.numPlanes +=d } } } function ce(e) { var t={}; return { get: function(n) { if (void 0 !==t[n]) return t[n]; var r; switch (n) { case "WEBGL_depth_texture" : r=e.getExtension("WEBGL_depth_texture") || e.getExtension("MOZ_WEBGL_depth_texture") || e.getExtension("WEBKIT_WEBGL_depth_texture"); break; case "EXT_texture_filter_anisotropic" : r=e.getExtension("EXT_texture_filter_anisotropic") || e.getExtension("MOZ_EXT_texture_filter_anisotropic") || e.getExtension("WEBKIT_EXT_texture_filter_anisotropic"); break; case "WEBGL_compressed_texture_s3tc" : r=e.getExtension("WEBGL_compressed_texture_s3tc") || e.getExtension("MOZ_WEBGL_compressed_texture_s3tc") || e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc"); break; case "WEBGL_compressed_texture_pvrtc" : r=e.getExtension("WEBGL_compressed_texture_pvrtc") || e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"); break; default: r=e.getExtension(n) } return null===r && console.warn("THREE.WebGLRenderer: " + n + " extension not supported."), t[n]=r, r } } } function le(e, t, n) { function r(e) { var i=e.target, a=c.get(i); null !==a.index && t.remove(a.index); for (var o in a.attributes) t.remove(a.attributes[o]); i.removeEventListener("dispose", r), c.delete(i); var s=l.get(a); s && (t.remove(s), l.delete(a)), n.memory.geometries-- } function i(e, t) { var i=c.get(t); return i || (t.addEventListener("dispose", r), t.isBufferGeometry ? i=t : t.isGeometry && (void 0===t._bufferGeometry && (t._bufferGeometry=(new G).setFromObject(e)), i=t._bufferGeometry), c.set(t, i), n.memory.geometries++, i) } function a(e) { var n=e.index, r=e.attributes; null !==n && t.update(n, 34963); for (var i in r) t.update(r[i], 34962); var a=e.morphAttributes; for (var i in a) for (var o=a[i], s=0, c=o.length; s < c; s++) t.update(o[s], 34962) } function o(e) { var n=[], r=e.index, i=e.attributes.position, a=0; if (null !==r) { var o=r.array; a=r.version; for (var s=0, c=o.length; s < c; s +=3) { var h=o[s + 0], u=o[s + 1], p=o[s + 2]; n.push(h, u, u, p, p, h) } } else { var o=i.array; a=i.version; for (var s=0, c=o.length / 3 - 1; s < c; s +=3) { var h=s + 0, u=s + 1, p=s + 2; n.push(h, u, u, p, p, h) } } var d=new(F(n)> 65535 ? N : D)(n, 1);
d.version = a, t.update(d, 34963);
var f = l.get(e);
f && t.remove(f), l.set(e, d)
}
function s(e) {
var t = l.get(e);
if (t) {
var n = e.index;
null !== n && t.version < n.version && o(e) } else o(e); return l.get(e) } var c=new WeakMap, l=new WeakMap; return { get: i, update: a, getWireframeAttribute: s } } function he(e, t, n, r) { function i(e) { c=e } function a(e) { l=e.type, h=e.bytesPerElement } function o(t, r) { e.drawElements(c, r, l, t * h), n.update(r, c) } function s(r, i, a, o) { if (0 !==o) { var s, p; if (u) s=e, p="drawElementsInstanced" ; else if (s=t.get("ANGLE_instanced_arrays"), p="drawElementsInstancedANGLE" , null===s) return void console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays."); s[p](c, a, l, i * h, o), n.update(a, c, o) } } var c, l, h, u=r.isWebGL2; this.setMode=i, this.setIndex=a, this.render=o, this.renderInstances=s } function ue(e) { function t(e, t, n) { switch (n=n || 1, i.calls++, t) { case 4: i.triangles +=n * (e / 3); break; case 1: i.lines +=n * (e / 2); break; case 3: i.lines +=n * (e - 1); break; case 2: i.lines +=n * e; break; case 0: i.points +=n * e; break; default: console.error("THREE.WebGLInfo: Unknown draw mode:", t) } } function n() { i.frame++, i.calls=0, i.triangles=0, i.points=0, i.lines=0 } var r={ geometries: 0, textures: 0 }, i={ frame: 0, calls: 0, triangles: 0, points: 0, lines: 0 }; return { memory: r, render: i, programs: null, autoReset: !0, reset: n, update: t } } function pe(e, t) { return Math.abs(t[1]) - Math.abs(e[1]) } function de(e) { function t(t, i, a, o) { var s=t.morphTargetInfluences, c=void 0===s ? 0 : s.length, l=n[i.id]; if (void 0===l) { l=[]; for (var h=0; h < c; h++) l[h]=[h, 0]; n[i.id]=l } for (var u=a.morphTargets && i.morphAttributes.position, p=a.morphNormals && i.morphAttributes.normal, h=0; h < c; h++) { var d=l[h]; 0 !==d[1] && (u && i.deleteAttribute("morphTarget" + h), p && i.deleteAttribute("morphNormal" + h)) } for (var h=0; h < c; h++) { var d=l[h]; d[0]=h, d[1]=s[h] } l.sort(pe); for (var f=0, h=0; h < 8; h++) { var d=l[h]; if (d) { var m=d[0], v=d[1]; if (v) { u && i.setAttribute("morphTarget" + h, u[m]), p && i.setAttribute("morphNormal" + h, p[m]), r[h]=v, f +=v; continue } } r[h]=0 } var g=i.morphTargetsRelative ? 1 : 1 - f; o.getUniforms().setValue(e, "morphTargetBaseInfluence" , g), o.getUniforms().setValue(e, "morphTargetInfluences" , r) } var n={}, r=new Float32Array(8); return { update: t } } function fe(e, t, n, r) { function i(e) { var i=r.render.frame, a=e.geometry, s=t.get(e, a); return o[s.id] !==i && (a.isGeometry && s.updateFromObject(e), t.update(s), o[s.id]=i), e.isInstancedMesh && n.update(e.instanceMatrix, 34962), s } function a() { o={} } var o={}; return { update: i, dispose: a } } function me(e, t, n, r, i, a, s, c, l, h) { e=void 0 !==e ? e : [], t=void 0 !==t ? t : Us, s=void 0 !==s ? s : dc, o.call(this, e, t, n, r, i, a, s, c, l, h), this.flipY=!1 } function ve(e, t, n, r) { o.call(this, null), this.image={ data: e || null, width: t || 1, height: n || 1, depth: r || 1 }, this.magFilter=Ys, this.minFilter=Ys, this.wrapR=qs, this.generateMipmaps=!1, this.flipY=!1, this.needsUpdate=!0 } function ge(e, t, n, r) { o.call(this, null), this.image={ data: e || null, width: t || 1, height: n || 1, depth: r || 1 }, this.magFilter=Ys, this.minFilter=Ys, this.wrapR=qs, this.generateMipmaps=!1, this.flipY=!1, this.needsUpdate=!0 } function ye(e, t, n) { var r=e[0]; if (r <=0 || r> 0) return e;
var i = t * n,
a = du[i];
if (void 0 === a && (a = new Float32Array(i), du[i] = a), 0 !== t) {
r.toArray(a, 0);
for (var o = 1, s = 0; o !== t; ++o) s += n, e[o].toArray(a, s)
}
return a
}
function xe(e, t) {
if (e.length !== t.length) return !1;
for (var n = 0, r = e.length; n < r; n++) if (e[n] !==t[n]) return !1; return !0 } function be(e, t) { for (var n=0, r=t.length; n < r; n++) e[n]=t[n] } function we(e, t) { var n=fu[t]; void 0===n && (n=new Int32Array(t), fu[t]=n); for (var r=0; r !==t; ++r) n[r]=e.allocateTextureUnit(); return n } function _e(e, t) { var n=this.cache; n[0] !==t && (e.uniform1f(this.addr, t), n[0]=t) } function Me(e, t) { var n=this.cache; if (void 0 !==t.x) n[0]===t.x && n[1]===t.y || (e.uniform2f(this.addr, t.x, t.y), n[0]=t.x, n[1]=t.y); else { if (xe(n, t)) return; e.uniform2fv(this.addr, t), be(n, t) } } function Se(e, t) { var n=this.cache; if (void 0 !==t.x) n[0]===t.x && n[1]===t.y && n[2]===t.z || (e.uniform3f(this.addr, t.x, t.y, t.z), n[0]=t.x, n[1]=t.y, n[2]=t.z); else if (void 0 !==t.r) n[0]===t.r && n[1]===t.g && n[2]===t.b || (e.uniform3f(this.addr, t.r, t.g, t.b), n[0]=t.r, n[1]=t.g, n[2]=t.b); else { if (xe(n, t)) return; e.uniform3fv(this.addr, t), be(n, t) } } function Te(e, t) { var n=this.cache; if (void 0 !==t.x) n[0]===t.x && n[1]===t.y && n[2]===t.z && n[3]===t.w || (e.uniform4f(this.addr, t.x, t.y, t.z, t.w), n[0]=t.x, n[1]=t.y, n[2]=t.z, n[3]=t.w); else { if (xe(n, t)) return; e.uniform4fv(this.addr, t), be(n, t) } } function Ee(e, t) { var n=this.cache, r=t.elements; if (void 0===r) { if (xe(n, t)) return; e.uniformMatrix2fv(this.addr, !1, t), be(n, t) } else { if (xe(n, r)) return; gu.set(r), e.uniformMatrix2fv(this.addr, !1, gu), be(n, r) } } function Ae(e, t) { var n=this.cache, r=t.elements; if (void 0===r) { if (xe(n, t)) return; e.uniformMatrix3fv(this.addr, !1, t), be(n, t) } else { if (xe(n, r)) return; vu.set(r), e.uniformMatrix3fv(this.addr, !1, vu), be(n, r) } } function Le(e, t) { var n=this.cache, r=t.elements; if (void 0===r) { if (xe(n, t)) return; e.uniformMatrix4fv(this.addr, !1, t), be(n, t) } else { if (xe(n, r)) return; mu.set(r), e.uniformMatrix4fv(this.addr, !1, mu), be(n, r) } } function Re(e, t, n) { var r=this.cache, i=n.allocateTextureUnit(); r[0] !==i && (e.uniform1i(this.addr, i), r[0]=i), n.safeSetTexture2D(t || lu, i) } function Pe(e, t, n) { var r=this.cache, i=n.allocateTextureUnit(); r[0] !==i && (e.uniform1i(this.addr, i), r[0]=i), n.setTexture2DArray(t || hu, i) } function Ce(e, t, n) { var r=this.cache, i=n.allocateTextureUnit(); r[0] !==i && (e.uniform1i(this.addr, i), r[0]=i), n.setTexture3D(t || uu, i) } function Oe(e, t, n) { var r=this.cache, i=n.allocateTextureUnit(); r[0] !==i && (e.uniform1i(this.addr, i), r[0]=i), n.safeSetTextureCube(t || pu, i) } function De(e, t) { var n=this.cache; n[0] !==t && (e.uniform1i(this.addr, t), n[0]=t) } function Ie(e, t) { var n=this.cache; xe(n, t) || (e.uniform2iv(this.addr, t), be(n, t)) } function Ne(e, t) { var n=this.cache; xe(n, t) || (e.uniform3iv(this.addr, t), be(n, t)) } function ze(e, t) { var n=this.cache; xe(n, t) || (e.uniform4iv(this.addr, t), be(n, t)) } function Be(e) { switch (e) { case 5126: return _e; case 35664: return Me; case 35665: return Se; case 35666: return Te; case 35674: return Ee; case 35675: return Ae; case 35676: return Le; case 35678: case 36198: return Re; case 35679: return Ce; case 35680: return Oe; case 36289: return Pe; case 5124: case 35670: return De; case 35667: case 35671: return Ie; case 35668: case 35672: return Ne; case 35669: case 35673: return ze } } function Ue(e, t) { e.uniform1fv(this.addr, t) } function Fe(e, t) { e.uniform1iv(this.addr, t) } function Ge(e, t) { e.uniform2iv(this.addr, t) } function He(e, t) { e.uniform3iv(this.addr, t) } function Ve(e, t) { e.uniform4iv(this.addr, t) } function je(e, t) { var n=ye(t, this.size, 2); e.uniform2fv(this.addr, n) } function ke(e, t) { var n=ye(t, this.size, 3); e.uniform3fv(this.addr, n) } function We(e, t) { var n=ye(t, this.size, 4); e.uniform4fv(this.addr, n) } function qe(e, t) { var n=ye(t, this.size, 4); e.uniformMatrix2fv(this.addr, !1, n) } function Xe(e, t) { var n=ye(t, this.size, 9); e.uniformMatrix3fv(this.addr, !1, n) } function Ye(e, t) { var n=ye(t, this.size, 16); e.uniformMatrix4fv(this.addr, !1, n) } function Ze(e, t, n) { var r=t.length, i=we(n, r); e.uniform1iv(this.addr, i); for (var a=0; a !==r; ++a) n.safeSetTexture2D(t[a] || lu, i[a]) } function Je(e, t, n) { var r=t.length, i=we(n, r); e.uniform1iv(this.addr, i); for (var a=0; a !==r; ++a) n.safeSetTextureCube(t[a] || pu, i[a]) } function Qe(e) { switch (e) { case 5126: return Ue; case 35664: return je; case 35665: return ke; case 35666: return We; case 35674: return qe; case 35675: return Xe; case 35676: return Ye; case 35678: return Ze; case 35680: return Je; case 5124: case 35670: return Fe; case 35667: case 35671: return Ge; case 35668: case 35672: return He; case 35669: case 35673: return Ve } } function Ke(e, t, n) { this.id=e, this.addr=n, this.cache=[], this.setValue=Be(t.type) } function $e(e, t, n) { this.id=e, this.addr=n, this.cache=[], this.size=t.size, this.setValue=Qe(t.type) } function et(e) { this.id=e, this.seq=[], this.map={} } function tt(e, t) { e.seq.push(t), e.map[t.id]=t } function nt(e, t, n) { var r=e.name, i=r.length; for (yu.lastIndex=0;;) { var a=yu.exec(r), o=yu.lastIndex, s=a[1], c="]"===a[2], l=a[3]; if (c && (s |=0), void 0===l || "["===l && o + 2===i) { tt(n, void 0===l ? new Ke(s, e, t) : new $e(s, e, t)); break } var h=n.map, u=h[s]; void 0===u && (u=new et(s), tt(n, u)), n=u } } function rt(e, t) { this.seq=[], this.map={}; for (var n=e.getProgramParameter(t, 35718), r=0; r < n; ++r) { var i=e.getActiveUniform(t, r); nt(i, e.getUniformLocation(t, i.name), this) } } function it(e, t, n) { var r=e.createShader(t); return e.shaderSource(r, n), e.compileShader(r), r } function at(e) { for (var t=e.split("\n"), n=0; n < t.length; n++) t[n]=n + 1 + ": " + t[n]; return t.join("\n") } function ot(e) { switch (e) { case qc: return ["Linear", "( value )" ]; case Xc: return ["sRGB", "( value )" ]; case Zc: return ["RGBE", "( value )" ]; case Qc: return ["RGBM", "( value, 7.0 )" ]; case Kc: return ["RGBM", "( value, 16.0 )" ]; case $c: return ["RGBD", "( value, 256.0 )" ]; case Yc: return ["Gamma", "( value, float( GAMMA_FACTOR ) )" ]; case Jc: return ["LogLuv", "( value )" ]; default: throw new Error("unsupported encoding: " + e)
}
}
function st(e, t, n) {
var r = e.getShaderParameter(t, 35713),
i = e.getShaderInfoLog(t).trim();
return r && "" === i ? "" : " THREE.WebGLShader: gl.getShaderInfoLog() " + n + " \n" + i + at(e.getShaderSource(t)) } function ct(e, t) { var n=ot(t); return "vec4 " + e + "( vec4 value ) { return " + n[0] + "ToLinear" + n[1] + "; }" } function lt(e, t) { var n=ot(t); return "vec4 " + e + "( vec4 value ) { return LinearTo" + n[0] + n[1] + "; }" } function ht(e, t) { var n; switch (t) { case Ds: n="Linear" ; break; case Is: n="Reinhard" ; break; case Ns: n="Uncharted2" ; break; case zs: n="OptimizedCineon" ; break; case Bs: n="ACESFilmic" ; break; default: throw new Error("unsupported toneMapping: " + t)
}
return " vec3 " + e + " ( vec3 color ) { return " + n + " ToneMapping( color ); }" } function ut(e, t, n) { return e=e || {}, [e.derivatives || t.envMapCubeUV || t.bumpMap || t.tangentSpaceNormalMap || t.clearcoatNormalMap || t.flatShading ? "#extension GL_OES_standard_derivatives : enable" : "" , (e.fragDepth || t.logarithmicDepthBuffer) && n.get("EXT_frag_depth") ? "#extension GL_EXT_frag_depth : enable" : "" , e.drawBuffers && n.get("WEBGL_draw_buffers") ? "#extension GL_EXT_draw_buffers : require" : "" , (e.shaderTextureLOD || t.envMap) && n.get("EXT_shader_texture_lod") ? "#extension GL_EXT_shader_texture_lod : enable" : "" ].filter(ft).join("\n") } function pt(e) { var t=[]; for (var n in e) { var r=e[n]; !1 !==r && t.push("#define " + n + " " + r)
}
return t.join(" \n") } function dt(e, t) { for (var n={}, r=e.getProgramParameter(t, 35721), i=0; i < r; i++) { var a=e.getActiveAttrib(t, i), o=a.name; n[o]=e.getAttribLocation(t, o) } return n } function ft(e) { return "" !==e } function mt(e, t) { return e.replace(/NUM_DIR_LIGHTS/g, t.numDirLights).replace(/NUM_SPOT_LIGHTS/g, t.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g, t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g, t.numPointLights).replace(/NUM_HEMI_LIGHTS/g, t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g, t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS/g, t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g, t.numPointLightShadows) } function vt(e, t) { return e.replace(/NUM_CLIPPING_PLANES/g, t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g, t.numClippingPlanes - t.numClipIntersection) } function gt(e) { return e.replace(bu, yt) } function yt(e, t) { var n=ou[t]; if (void 0===n) throw new Error("Can not resolve #include <" + t + ">" ); return gt(n) } function xt(e) { return e.replace(wu, bt) } function bt(e, t, n, r) { for (var i="" , a=parseInt(t); a < parseInt(n); a++) i +=r.replace(/\[ i \]/g, "[ " + a + " ]" ).replace(/UNROLLED_LOOP_INDEX/g, a); return i } function wt(e) { var t="precision " + e.precision + " float;\nprecision " + e.precision + " int;" ; return "highp"===e.precision ? t +="\n#define HIGH_PRECISION" : "mediump"===e.precision ? t +="\n#define MEDIUM_PRECISION" : "lowp"===e.precision && (t +="\n#define LOW_PRECISION" ), t } function _t(e) { var t="SHADOWMAP_TYPE_BASIC" ; return e.shadowMapType===ko ? t="SHADOWMAP_TYPE_PCF" : e.shadowMapType===Wo ? t="SHADOWMAP_TYPE_PCF_SOFT" : e.shadowMapType===qo && (t="SHADOWMAP_TYPE_VSM" ), t } function Mt(e) { var t="ENVMAP_TYPE_CUBE" ; if (e.envMap) switch (e.envMapMode) { case Us: case Fs: t="ENVMAP_TYPE_CUBE" ; break; case js: case ks: t="ENVMAP_TYPE_CUBE_UV" ; break; case Gs: case Hs: t="ENVMAP_TYPE_EQUIREC" ; break; case Vs: t="ENVMAP_TYPE_SPHERE" } return t } function St(e) { var t="ENVMAP_MODE_REFLECTION" ; if (e.envMap) switch (e.envMapMode) { case Fs: case Hs: t="ENVMAP_MODE_REFRACTION" } return t } function Tt(e) { var t="ENVMAP_BLENDING_NONE" ; if (e.envMap) switch (e.combine) { case Rs: t="ENVMAP_BLENDING_MULTIPLY" ; break; case Ps: t="ENVMAP_BLENDING_MIX" ; break; case Cs: t="ENVMAP_BLENDING_ADD" } return t } function Et(e, t, n, r, i, a) { var o, s, c=e.getContext(), l=r.defines, h=i.vertexShader, u=i.fragmentShader, p=_t(a), d=Mt(a), f=St(a), m=Tt(a), v=e.gammaFactor> 0 ? e.gammaFactor : 1,
g = a.isWebGL2 ? "" : ut(r.extensions, a, t),
y = pt(l),
x = c.createProgram(),
b = a.numMultiviewViews;
if (r.isRawShaderMaterial ? (o = [y].filter(ft).join("\n"), o.length > 0 && (o += "\n"), s = [g, y].filter(ft).join("\n"), s.length > 0 && (s += "\n")) : (o = [wt(a), "#define SHADER_NAME " + i.name, y, a.instancing ? "#define USE_INSTANCING" : "", a.supportsVertexTextures ? "#define VERTEX_TEXTURES" : "", "#define GAMMA_FACTOR " + v, "#define MAX_BONES " + a.maxBones, a.useFog && a.fog ? "#define USE_FOG" : "", a.useFog && a.fogExp2 ? "#define FOG_EXP2" : "", a.map ? "#define USE_MAP" : "", a.envMap ? "#define USE_ENVMAP" : "", a.envMap ? "#define " + f : "", a.lightMap ? "#define USE_LIGHTMAP" : "", a.aoMap ? "#define USE_AOMAP" : "", a.emissiveMap ? "#define USE_EMISSIVEMAP" : "", a.bumpMap ? "#define USE_BUMPMAP" : "", a.normalMap ? "#define USE_NORMALMAP" : "", a.normalMap && a.objectSpaceNormalMap ? "#define OBJECTSPACE_NORMALMAP" : "", a.normalMap && a.tangentSpaceNormalMap ? "#define TANGENTSPACE_NORMALMAP" : "", a.clearcoatNormalMap ? "#define USE_CLEARCOAT_NORMALMAP" : "", a.displacementMap && a.supportsVertexTextures ? "#define USE_DISPLACEMENTMAP" : "", a.specularMap ? "#define USE_SPECULARMAP" : "", a.roughnessMap ? "#define USE_ROUGHNESSMAP" : "", a.metalnessMap ? "#define USE_METALNESSMAP" : "", a.alphaMap ? "#define USE_ALPHAMAP" : "", a.vertexTangents ? "#define USE_TANGENT" : "", a.vertexColors ? "#define USE_COLOR" : "", a.vertexUvs ? "#define USE_UV" : "", a.uvsVertexOnly ? "#define UVS_VERTEX_ONLY" : "", a.flatShading ? "#define FLAT_SHADED" : "", a.skinning ? "#define USE_SKINNING" : "", a.useVertexTexture ? "#define BONE_TEXTURE" : "", a.morphTargets ? "#define USE_MORPHTARGETS" : "", a.morphNormals && !1 === a.flatShading ? "#define USE_MORPHNORMALS" : "", a.doubleSided ? "#define DOUBLE_SIDED" : "", a.flipSided ? "#define FLIP_SIDED" : "", a.shadowMapEnabled ? "#define USE_SHADOWMAP" : "", a.shadowMapEnabled ? "#define " + p : "", a.sizeAttenuation ? "#define USE_SIZEATTENUATION" : "", a.logarithmicDepthBuffer ? "#define USE_LOGDEPTHBUF" : "", a.logarithmicDepthBuffer && (a.isWebGL2 || t.get("EXT_frag_depth")) ? "#define USE_LOGDEPTHBUF_EXT" : "", "uniform mat4 modelMatrix;", "uniform mat4 modelViewMatrix;", "uniform mat4 projectionMatrix;", "uniform mat4 viewMatrix;", "uniform mat3 normalMatrix;", "uniform vec3 cameraPosition;", "uniform bool isOrthographic;", "#ifdef USE_INSTANCING", " attribute mat4 instanceMatrix;", "#endif", "attribute vec3 position;", "attribute vec3 normal;", "attribute vec2 uv;", "#ifdef USE_TANGENT", "\tattribute vec4 tangent;", "#endif", "#ifdef USE_COLOR", "\tattribute vec3 color;", "#endif", "#ifdef USE_MORPHTARGETS", "\tattribute vec3 morphTarget0;", "\tattribute vec3 morphTarget1;", "\tattribute vec3 morphTarget2;", "\tattribute vec3 morphTarget3;", "\t#ifdef USE_MORPHNORMALS", "\t\tattribute vec3 morphNormal0;", "\t\tattribute vec3 morphNormal1;", "\t\tattribute vec3 morphNormal2;", "\t\tattribute vec3 morphNormal3;", "\t#else", "\t\tattribute vec3 morphTarget4;", "\t\tattribute vec3 morphTarget5;", "\t\tattribute vec3 morphTarget6;", "\t\tattribute vec3 morphTarget7;", "\t#endif", "#endif", "#ifdef USE_SKINNING", "\tattribute vec4 skinIndex;", "\tattribute vec4 skinWeight;", "#endif", "\n"].filter(ft).join("\n"), s = [g, wt(a), "#define SHADER_NAME " + i.name, y, a.alphaTest ? "#define ALPHATEST " + a.alphaTest + (a.alphaTest % 1 ? "" : ".0") : "", "#define GAMMA_FACTOR " + v, a.useFog && a.fog ? "#define USE_FOG" : "", a.useFog && a.fogExp2 ? "#define FOG_EXP2" : "", a.map ? "#define USE_MAP" : "", a.matcap ? "#define USE_MATCAP" : "", a.envMap ? "#define USE_ENVMAP" : "", a.envMap ? "#define " + d : "", a.envMap ? "#define " + f : "", a.envMap ? "#define " + m : "", a.lightMap ? "#define USE_LIGHTMAP" : "", a.aoMap ? "#define USE_AOMAP" : "", a.emissiveMap ? "#define USE_EMISSIVEMAP" : "", a.bumpMap ? "#define USE_BUMPMAP" : "", a.normalMap ? "#define USE_NORMALMAP" : "", a.normalMap && a.objectSpaceNormalMap ? "#define OBJECTSPACE_NORMALMAP" : "", a.normalMap && a.tangentSpaceNormalMap ? "#define TANGENTSPACE_NORMALMAP" : "", a.clearcoatNormalMap ? "#define USE_CLEARCOAT_NORMALMAP" : "", a.specularMap ? "#define USE_SPECULARMAP" : "", a.roughnessMap ? "#define USE_ROUGHNESSMAP" : "", a.metalnessMap ? "#define USE_METALNESSMAP" : "", a.alphaMap ? "#define USE_ALPHAMAP" : "", a.sheen ? "#define USE_SHEEN" : "", a.vertexTangents ? "#define USE_TANGENT" : "", a.vertexColors ? "#define USE_COLOR" : "", a.vertexUvs ? "#define USE_UV" : "", a.uvsVertexOnly ? "#define UVS_VERTEX_ONLY" : "", a.gradientMap ? "#define USE_GRADIENTMAP" : "", a.flatShading ? "#define FLAT_SHADED" : "", a.doubleSided ? "#define DOUBLE_SIDED" : "", a.flipSided ? "#define FLIP_SIDED" : "", a.shadowMapEnabled ? "#define USE_SHADOWMAP" : "", a.shadowMapEnabled ? "#define " + p : "", a.premultipliedAlpha ? "#define PREMULTIPLIED_ALPHA" : "", a.physicallyCorrectLights ? "#define PHYSICALLY_CORRECT_LIGHTS" : "", a.logarithmicDepthBuffer ? "#define USE_LOGDEPTHBUF" : "", a.logarithmicDepthBuffer && (a.isWebGL2 || t.get("EXT_frag_depth")) ? "#define USE_LOGDEPTHBUF_EXT" : "", (r.extensions && r.extensions.shaderTextureLOD || a.envMap) && (a.isWebGL2 || t.get("EXT_shader_texture_lod")) ? "#define TEXTURE_LOD_EXT" : "", "uniform mat4 viewMatrix;", "uniform vec3 cameraPosition;", "uniform bool isOrthographic;", a.toneMapping !== Os ? "#define TONE_MAPPING" : "", a.toneMapping !== Os ? ou.tonemapping_pars_fragment : "", a.toneMapping !== Os ? ht("toneMapping", a.toneMapping) : "", a.dithering ? "#define DITHERING" : "", a.outputEncoding || a.mapEncoding || a.matcapEncoding || a.envMapEncoding || a.emissiveMapEncoding || a.lightMapEncoding ? ou.encodings_pars_fragment : "", a.mapEncoding ? ct("mapTexelToLinear", a.mapEncoding) : "", a.matcapEncoding ? ct("matcapTexelToLinear", a.matcapEncoding) : "", a.envMapEncoding ? ct("envMapTexelToLinear", a.envMapEncoding) : "", a.emissiveMapEncoding ? ct("emissiveMapTexelToLinear", a.emissiveMapEncoding) : "", a.lightMapEncoding ? ct("lightMapTexelToLinear", a.lightMapEncoding) : "", a.outputEncoding ? lt("linearToOutputTexel", a.outputEncoding) : "", a.depthPacking ? "#define DEPTH_PACKING " + r.depthPacking : "", "\n"].filter(ft).join("\n")), h = gt(h), h = mt(h, a), h = vt(h, a), u = gt(u), u = mt(u, a), u = vt(u, a), h = xt(h), u = xt(u), a.isWebGL2 && !r.isRawShaderMaterial) {
var w = !1,
_ = /^\s*#version\s+300\s+es\s*\n/;
r.isShaderMaterial && null !== h.match(_) && null !== u.match(_) && (w = !0, h = h.replace(_, ""), u = u.replace(_, "")), o = ["#version 300 es\n", "#define attribute in", "#define varying out", "#define texture2D texture"].join("\n") + "\n" + o, s = ["#version 300 es\n", "#define varying in", w ? "" : "out highp vec4 pc_fragColor;", w ? "" : "#define gl_FragColor pc_fragColor", "#define gl_FragDepthEXT gl_FragDepth", "#define texture2D texture", "#define textureCube texture", "#define texture2DProj textureProj", "#define texture2DLodEXT textureLod", "#define texture2DProjLodEXT textureProjLod", "#define textureCubeLodEXT textureLod", "#define texture2DGradEXT textureGrad", "#define texture2DProjGradEXT textureProjGrad", "#define textureCubeGradEXT textureGrad"].join("\n") + "\n" + s, b > 0 && (o = o.replace("#version 300 es\n", ["#version 300 es\n", "#extension GL_OVR_multiview2 : require", "layout(num_views = " + b + ") in;", "#define VIEW_ID gl_ViewID_OVR"].join("\n")), o = o.replace(["uniform mat4 modelViewMatrix;", "uniform mat4 projectionMatrix;", "uniform mat4 viewMatrix;", "uniform mat3 normalMatrix;"].join("\n"), ["uniform mat4 modelViewMatrices[" + b + "];", "uniform mat4 projectionMatrices[" + b + "];", "uniform mat4 viewMatrices[" + b + "];", "uniform mat3 normalMatrices[" + b + "];", "#define modelViewMatrix modelViewMatrices[VIEW_ID]", "#define projectionMatrix projectionMatrices[VIEW_ID]", "#define viewMatrix viewMatrices[VIEW_ID]", "#define normalMatrix normalMatrices[VIEW_ID]"].join("\n")), s = s.replace("#version 300 es\n", ["#version 300 es\n", "#extension GL_OVR_multiview2 : require", "#define VIEW_ID gl_ViewID_OVR"].join("\n")), s = s.replace("uniform mat4 viewMatrix;", ["uniform mat4 viewMatrices[" + b + "];", "#define viewMatrix viewMatrices[VIEW_ID]"].join("\n")))
}
var M = o + h,
S = s + u,
T = it(c, 35633, M),
E = it(c, 35632, S);
if (c.attachShader(x, T), c.attachShader(x, E), void 0 !== r.index0AttributeName ? c.bindAttribLocation(x, 0, r.index0AttributeName) : !0 === a.morphTargets && c.bindAttribLocation(x, 0, "position"), c.linkProgram(x), e.debug.checkShaderErrors) {
var A = c.getProgramInfoLog(x).trim(),
L = c.getShaderInfoLog(T).trim(),
R = c.getShaderInfoLog(E).trim(),
P = !0,
C = !0;
if (!1 === c.getProgramParameter(x, 35714)) {
P = !1;
var O = st(c, T, "vertex"),
D = st(c, E, "fragment");
console.error("THREE.WebGLProgram: shader error: ", c.getError(), "35715", c.getProgramParameter(x, 35715), "gl.getProgramInfoLog", A, O, D)
} else "" !== A ? console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()", A) : "" !== L && "" !== R || (C = !1);
C && (this.diagnostics = {
runnable: P,
material: r,
programLog: A,
vertexShader: {
log: L,
prefix: o
},
fragmentShader: {
log: R,
prefix: s
}
})
}
c.deleteShader(T), c.deleteShader(E);
var I;
this.getUniforms = function() {
return void 0 === I && (I = new rt(c, x)), I
};
var N;
return this.getAttributes = function() {
return void 0 === N && (N = dt(c, x)), N
}, this.destroy = function() {
c.deleteProgram(x), this.program = void 0
}, this.name = i.name, this.id = xu++, this.cacheKey = n, this.usedTimes = 1, this.program = x, this.vertexShader = T, this.fragmentShader = E, this.numMultiviewViews = b, this
}
function At(e, t, n) {
function r(e) {
var t = e.skeleton,
n = t.bones;
if (c) return 1024;
var r = h,
i = Math.floor((r - 20) / 4),
a = Math.min(i, n.length);
return a < n.length ? (console.warn("THREE.WebGLRenderer: Skeleton has " + n.length + " bones. This GPU supports " + a + " ."), 0) : a } function i(e, t) { var n; return e ? e.isTexture ? n=e.encoding : e.isWebGLRenderTarget && (console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."), n=e.texture.encoding) : n=qc, n===qc && t && (n=Yc), n } var a=[], o=n.isWebGL2, s=n.logarithmicDepthBuffer, c=n.floatVertexTextures, l=n.precision, h=n.maxVertexUniforms, u=n.vertexTextures, p={ MeshDepthMaterial: "depth" , MeshDistanceMaterial: "distanceRGBA" , MeshNormalMaterial: "normal" , MeshBasicMaterial: "basic" , MeshLambertMaterial: "lambert" , MeshPhongMaterial: "phong" , MeshToonMaterial: "toon" , MeshStandardMaterial: "physical" , MeshPhysicalMaterial: "physical" , MeshMatcapMaterial: "matcap" , LineBasicMaterial: "basic" , LineDashedMaterial: "dashed" , PointsMaterial: "points" , ShadowMaterial: "shadow" , SpriteMaterial: "sprite" }, d=["precision", "isWebGL2" , "supportsVertexTextures" , "outputEncoding" , "instancing" , "numMultiviewViews" , "map" , "mapEncoding" , "matcap" , "matcapEncoding" , "envMap" , "envMapMode" , "envMapEncoding" , "envMapCubeUV" , "lightMap" , "lightMapEncoding" , "aoMap" , "emissiveMap" , "emissiveMapEncoding" , "bumpMap" , "normalMap" , "objectSpaceNormalMap" , "tangentSpaceNormalMap" , "clearcoatNormalMap" , "displacementMap" , "specularMap" , "roughnessMap" , "metalnessMap" , "gradientMap" , "alphaMap" , "combine" , "vertexColors" , "vertexTangents" , "vertexUvs" , "uvsVertexOnly" , "fog" , "useFog" , "fogExp2" , "flatShading" , "sizeAttenuation" , "logarithmicDepthBuffer" , "skinning" , "maxBones" , "useVertexTexture" , "morphTargets" , "morphNormals" , "maxMorphTargets" , "maxMorphNormals" , "premultipliedAlpha" , "numDirLights" , "numPointLights" , "numSpotLights" , "numHemiLights" , "numRectAreaLights" , "numDirLightShadows" , "numPointLightShadows" , "numSpotLightShadows" , "shadowMapEnabled" , "shadowMapType" , "toneMapping" , "physicallyCorrectLights" , "alphaTest" , "doubleSided" , "flipSided" , "numClippingPlanes" , "numClipIntersection" , "depthPacking" , "dithering" , "sheen" ]; this.getParameters=function(t, a, h, d, f, m, v) { var g=p[t.type], y=v.isSkinnedMesh ? r(v) : 0; null !==t.precision && (l=n.getMaxPrecision(t.precision)) !==t.precision && console.warn("THREE.WebGLProgram.getParameters:", t.precision, "not supported, using" , l, "instead." ); var x=e.getRenderTarget(), b=x && x.isWebGLMultiviewRenderTarget ? x.numViews : 0; return { isWebGL2: o, shaderID: g, precision: l, instancing: !0===v.isInstancedMesh, supportsVertexTextures: u, numMultiviewViews: b, outputEncoding: i(x ? x.texture : null, e.gammaOutput), map: !!t.map, mapEncoding: i(t.map), matcap: !!t.matcap, matcapEncoding: i(t.matcap), envMap: !!t.envMap, envMapMode: t.envMap && t.envMap.mapping, envMapEncoding: i(t.envMap), envMapCubeUV: !!t.envMap && (t.envMap.mapping===js || t.envMap.mapping===ks), lightMap: !!t.lightMap, lightMapEncoding: i(t.lightMap), aoMap: !!t.aoMap, emissiveMap: !!t.emissiveMap, emissiveMapEncoding: i(t.emissiveMap), bumpMap: !!t.bumpMap, normalMap: !!t.normalMap, objectSpaceNormalMap: t.normalMapType===rl, tangentSpaceNormalMap: t.normalMapType===nl, clearcoatNormalMap: !!t.clearcoatNormalMap, displacementMap: !!t.displacementMap, roughnessMap: !!t.roughnessMap, metalnessMap: !!t.metalnessMap, specularMap: !!t.specularMap, alphaMap: !!t.alphaMap, gradientMap: !!t.gradientMap, sheen: !!t.sheen, combine: t.combine, vertexTangents: t.normalMap && t.vertexTangents, vertexColors: t.vertexColors, vertexUvs: !!(t.map || t.bumpMap || t.normalMap || t.specularMap || t.alphaMap || t.emissiveMap || t.roughnessMap || t.metalnessMap || t.clearcoatNormalMap || t.displacementMap), uvsVertexOnly: !(t.map || t.bumpMap || t.normalMap || t.specularMap || t.alphaMap || t.emissiveMap || t.roughnessMap || t.metalnessMap || t.clearcoatNormalMap || !t.displacementMap), fog: !!d, useFog: t.fog, fogExp2: d && d.isFogExp2, flatShading: t.flatShading, sizeAttenuation: t.sizeAttenuation, logarithmicDepthBuffer: s, skinning: t.skinning && y> 0,
maxBones: y,
useVertexTexture: c,
morphTargets: t.morphTargets,
morphNormals: t.morphNormals,
maxMorphTargets: e.maxMorphTargets,
maxMorphNormals: e.maxMorphNormals,
numDirLights: a.directional.length,
numPointLights: a.point.length,
numSpotLights: a.spot.length,
numRectAreaLights: a.rectArea.length,
numHemiLights: a.hemi.length,
numDirLightShadows: a.directionalShadowMap.length,
numPointLightShadows: a.pointShadowMap.length,
numSpotLightShadows: a.spotShadowMap.length,
numClippingPlanes: f,
numClipIntersection: m,
dithering: t.dithering,
shadowMapEnabled: e.shadowMap.enabled && h.length > 0,
shadowMapType: e.shadowMap.type,
toneMapping: t.toneMapped ? e.toneMapping : Os,
physicallyCorrectLights: e.physicallyCorrectLights,
premultipliedAlpha: t.premultipliedAlpha,
alphaTest: t.alphaTest,
doubleSided: t.side === Zo,
flipSided: t.side === Yo,
depthPacking: void 0 !== t.depthPacking && t.depthPacking
}
}, this.getProgramCacheKey = function(t, n) {
var r = [];
if (n.shaderID ? r.push(n.shaderID) : (r.push(t.fragmentShader), r.push(t.vertexShader)), void 0 !== t.defines)
for (var i in t.defines) r.push(i), r.push(t.defines[i]);
for (var a = 0; a < d.length; a++) r.push(n[d[a]]); return r.push(t.onBeforeCompile.toString()), r.push(e.gammaOutput), r.push(e.gammaFactor), r.join() }, this.acquireProgram=function(n, r, i, o) { for (var s, c=0, l=a.length; c < l; c++) { var h=a[c]; if (h.cacheKey===o) { s=h, ++s.usedTimes; break } } return void 0===s && (s=new Et(e, t, o, n, r, i), a.push(s)), s }, this.releaseProgram=function(e) { if (0==--e.usedTimes) { var t=a.indexOf(e); a[t]=a[a.length - 1], a.pop(), e.destroy() } }, this.programs=a } function Lt() { function e(e) { var t=i.get(e); return void 0===t && (t={}, i.set(e, t)), t } function t(e) { i.delete(e) } function n(e, t, n) { i.get(e)[t]=n } function r() { i=new WeakMap } var i=new WeakMap; return { get: e, remove: t, update: n, dispose: r } } function Rt(e, t) { return e.groupOrder !==t.groupOrder ? e.groupOrder - t.groupOrder : e.renderOrder !==t.renderOrder ? e.renderOrder - t.renderOrder : e.program !==t.program ? e.program.id - t.program.id : e.material.id !==t.material.id ? e.material.id - t.material.id : e.z !==t.z ? e.z - t.z : e.id - t.id } function Pt(e, t) { return e.groupOrder !==t.groupOrder ? e.groupOrder - t.groupOrder : e.renderOrder !==t.renderOrder ? e.renderOrder - t.renderOrder : e.z !==t.z ? t.z - e.z : e.id - t.id } function Ct() { function e() { o=0, s.length=0, c.length=0 } function t(e, t, n, r, i, s) { var c=a[o]; return void 0===c ? (c={ id: e.id, object: e, geometry: t, material: n, program: n.program || l, groupOrder: r, renderOrder: e.renderOrder, z: i, group: s }, a[o]=c) : (c.id=e.id, c.object=e, c.geometry=t, c.material=n, c.program=n.program || l, c.groupOrder=r, c.renderOrder=e.renderOrder, c.z=i, c.group=s), o++, c } function n(e, n, r, i, a, o) { var l=t(e, n, r, i, a, o); (!0===r.transparent ? c : s).push(l) } function r(e, n, r, i, a, o) { var l=t(e, n, r, i, a, o); (!0===r.transparent ? c : s).unshift(l) } function i() { s.length> 1 && s.sort(Rt), c.length > 1 && c.sort(Pt)
}
var a = [],
o = 0,
s = [],
c = [],
l = {
id: -1
};
return {
opaque: s,
transparent: c,
init: e,
push: n,
unshift: r,
sort: i
}
}
function Ot() {
function e(t) {
var n = t.target;
n.removeEventListener("dispose", e), r.delete(n)
}
function t(t, n) {
var i, a = r.get(t);
return void 0 === a ? (i = new Ct, r.set(t, new WeakMap), r.get(t).set(n, i), t.addEventListener("dispose", e)) : void 0 === (i = a.get(n)) && (i = new Ct, a.set(n, i)), i
}
function n() {
r = new WeakMap
}
var r = new WeakMap;
return {
get: t,
dispose: n
}
}
function Dt() {
var e = {};
return {
get: function(t) {
if (void 0 !== e[t.id]) return e[t.id];
var r;
switch (t.type) {
case "DirectionalLight":
r = {
direction: new i,
color: new w,
shadow: !1,
shadowBias: 0,
shadowRadius: 1,
shadowMapSize: new n
};
break;
case "SpotLight":
r = {
position: new i,
direction: new i,
color: new w,
distance: 0,
coneCos: 0,
penumbraCos: 0,
decay: 0,
shadow: !1,
shadowBias: 0,
shadowRadius: 1,
shadowMapSize: new n
};
break;
case "PointLight":
r = {
position: new i,
color: new w,
distance: 0,
decay: 0,
shadow: !1,
shadowBias: 0,
shadowRadius: 1,
shadowMapSize: new n,
shadowCameraNear: 1,
shadowCameraFar: 1e3
};
break;
case "HemisphereLight":
r = {
direction: new i,
skyColor: new w,
groundColor: new w
};
break;
case "RectAreaLight":
r = {
color: new w,
position: new i,
halfWidth: new i,
halfHeight: new i
}
}
return e[t.id] = r, r
}
}
}
function It(e, t) {
return (t.castShadow ? 1 : 0) - (e.castShadow ? 1 : 0)
}
function Nt() {
function e(e, r, i) {
for (var c = 0, l = 0, h = 0, u = 0; u < 9; u++) n.probe[u].set(0, 0, 0); var p=0, d=0, f=0, m=0, v=0, g=0, y=0, x=0, b=i.matrixWorldInverse; e.sort(It); for (var u=0, w=e.length; u < w; u++) { var _=e[u], M=_.color, S=_.intensity, T=_.distance, E=_.shadow && _.shadow.map ? _.shadow.map.texture : null; if (_.isAmbientLight) c +=M.r * S, l +=M.g * S, h +=M.b * S; else if (_.isLightProbe) for (var A=0; A < 9; A++) n.probe[A].addScaledVector(_.sh.coefficients[A], S); else if (_.isDirectionalLight) { var L=t.get(_); if (L.color.copy(_.color).multiplyScalar(_.intensity), L.direction.setFromMatrixPosition(_.matrixWorld), a.setFromMatrixPosition(_.target.matrixWorld), L.direction.sub(a), L.direction.transformDirection(b), L.shadow=_.castShadow, _.castShadow) { var R=_.shadow; L.shadowBias=R.bias, L.shadowRadius=R.radius, L.shadowMapSize=R.mapSize, n.directionalShadowMap[p]=E, n.directionalShadowMatrix[p]=_.shadow.matrix, g++ } n.directional[p]=L, p++ } else if (_.isSpotLight) { var L=t.get(_); if (L.position.setFromMatrixPosition(_.matrixWorld), L.position.applyMatrix4(b), L.color.copy(M).multiplyScalar(S), L.distance=T, L.direction.setFromMatrixPosition(_.matrixWorld), a.setFromMatrixPosition(_.target.matrixWorld), L.direction.sub(a), L.direction.transformDirection(b), L.coneCos=Math.cos(_.angle), L.penumbraCos=Math.cos(_.angle * (1 - _.penumbra)), L.decay=_.decay, L.shadow=_.castShadow, _.castShadow) { var R=_.shadow; L.shadowBias=R.bias, L.shadowRadius=R.radius, L.shadowMapSize=R.mapSize, n.spotShadowMap[f]=E, n.spotShadowMatrix[f]=_.shadow.matrix, x++ } n.spot[f]=L, f++ } else if (_.isRectAreaLight) { var L=t.get(_); L.color.copy(M).multiplyScalar(S), L.position.setFromMatrixPosition(_.matrixWorld), L.position.applyMatrix4(b), s.identity(), o.copy(_.matrixWorld), o.premultiply(b), s.extractRotation(o), L.halfWidth.set(.5 * _.width, 0, 0), L.halfHeight.set(0, .5 * _.height, 0), L.halfWidth.applyMatrix4(s), L.halfHeight.applyMatrix4(s), n.rectArea[m]=L, m++ } else if (_.isPointLight) { var L=t.get(_); if (L.position.setFromMatrixPosition(_.matrixWorld), L.position.applyMatrix4(b), L.color.copy(_.color).multiplyScalar(_.intensity), L.distance=_.distance, L.decay=_.decay, L.shadow=_.castShadow, _.castShadow) { var R=_.shadow; L.shadowBias=R.bias, L.shadowRadius=R.radius, L.shadowMapSize=R.mapSize, L.shadowCameraNear=R.camera.near, L.shadowCameraFar=R.camera.far, n.pointShadowMap[d]=E, n.pointShadowMatrix[d]=_.shadow.matrix, y++ } n.point[d]=L, d++ } else if (_.isHemisphereLight) { var L=t.get(_); L.direction.setFromMatrixPosition(_.matrixWorld), L.direction.transformDirection(b), L.direction.normalize(), L.skyColor.copy(_.color).multiplyScalar(S), L.groundColor.copy(_.groundColor).multiplyScalar(S), n.hemi[v]=L, v++ } } n.ambient[0]=c, n.ambient[1]=l, n.ambient[2]=h; var P=n.hash; P.directionalLength===p && P.pointLength===d && P.spotLength===f && P.rectAreaLength===m && P.hemiLength===v && P.numDirectionalShadows===g && P.numPointShadows===y && P.numSpotShadows===x || (n.directional.length=p, n.spot.length=f, n.rectArea.length=m, n.point.length=d, n.hemi.length=v, n.directionalShadowMap.length=g, n.pointShadowMap.length=y, n.spotShadowMap.length=x, n.directionalShadowMatrix.length=g, n.pointShadowMatrix.length=y, n.spotShadowMatrix.length=x, P.directionalLength=p, P.pointLength=d, P.spotLength=f, P.rectAreaLength=m, P.hemiLength=v, P.numDirectionalShadows=g, P.numPointShadows=y, P.numSpotShadows=x, n.version=_u++) } for (var t=new Dt, n={ version: 0, hash: { directionalLength: -1, pointLength: -1, spotLength: -1, rectAreaLength: -1, hemiLength: -1, numDirectionalShadows: -1, numPointShadows: -1, numSpotShadows: -1 }, ambient: [0, 0, 0], probe: [], directional: [], directionalShadowMap: [], directionalShadowMatrix: [], spot: [], spotShadowMap: [], spotShadowMatrix: [], rectArea: [], point: [], pointShadowMap: [], pointShadowMatrix: [], hemi: [], numDirectionalShadows: -1, numPointShadows: -1, numSpotShadows: -1 }, r=0; r < 9; r++) n.probe.push(new i); var a=new i, o=new h, s=new h; return { setup: e, state: n } } function zt() { function e() { a.length=0, o.length=0 } function t(e) { a.push(e) } function n(e) { o.push(e) } function r(e) { i.setup(a, o, e) } var i=new Nt, a=[], o=[]; return { init: e, state: { lightsArray: a, shadowsArray: o, lights: i }, setupLights: r, pushLight: t, pushShadow: n } } function Bt() { function e(t) { var n=t.target; n.removeEventListener("dispose", e), r.delete(n) } function t(t, n) { var i; return !1===r.has(t) ? (i=new zt, r.set(t, new WeakMap), r.get(t).set(n, i), t.addEventListener("dispose", e)) : !1===r.get(t).has(n) ? (i=new zt, r.get(t).set(n, i)) : i=r.get(t).get(n), i } function n() { r=new WeakMap } var r=new WeakMap; return { get: t, dispose: n } } function Ut(e) { E.call(this), this.type="MeshDepthMaterial" , this.depthPacking=el, this.skinning=!1, this.morphTargets=!1, this.map=null, this.alphaMap=null, this.displacementMap=null, this.displacementScale=1, this.displacementBias=0, this.wireframe=!1, this.wireframeLinewidth=1, this.fog=!1, this.setValues(e) } function Ft(e) { E.call(this), this.type="MeshDistanceMaterial" , this.referencePosition=new i, this.nearDistance=1, this.farDistance=1e3, this.skinning=!1, this.morphTargets=!1, this.map=null, this.alphaMap=null, this.displacementMap=null, this.displacementScale=1, this.displacementBias=0, this.fog=!1, this.setValues(e) } function Gt(e, t, r) { function i(n, r) { var i=t.update(_); x.uniforms.shadow_pass.value=n.map.texture, x.uniforms.resolution.value=n.mapSize, x.uniforms.radius.value=n.radius, e.setRenderTarget(n.mapPass), e.clear(), e.renderBufferDirect(r, null, i, x, _, null), b.uniforms.shadow_pass.value=n.mapPass.texture, b.uniforms.resolution.value=n.mapSize, b.uniforms.radius.value=n.radius, e.setRenderTarget(n.map), e.clear(), e.renderBufferDirect(r, null, i, b, _, null) } function a(e, t, n) { var r=e << 0 | t << 1 | n << 2, i=m[r]; return void 0===i && (i=new Ut({ depthPacking: tl, morphTargets: e, skinning: t }), m[r]=i), i } function o(e, t, n) { var r=e << 0 | t << 1 | n << 2, i=v[r]; return void 0===i && (i=new Ft({ morphTargets: e, skinning: t }), v[r]=i), i } function l(t, n, r, i, s, c) { var l=t.geometry, h=null, u=a, p=t.customDepthMaterial; if (!0===r.isPointLight && (u=o, p=t.customDistanceMaterial), void 0===p) { var d=!1; !0===n.morphTargets && (!0===l.isBufferGeometry ? d=l.morphAttributes && l.morphAttributes.position && l.morphAttributes.position.length> 0 : !0 === l.isGeometry && (d = l.morphTargets && l.morphTargets.length > 0));
var f = !1;
!0 === t.isSkinnedMesh && (!0 === n.skinning ? f = !0 : console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:", t));
h = u(d, f, !0 === t.isInstancedMesh)
} else h = p;
if (e.localClippingEnabled && !0 === n.clipShadows && 0 !== n.clippingPlanes.length) {
var m = h.uuid,
v = n.uuid,
x = g[m];
void 0 === x && (x = {}, g[m] = x);
var b = x[v];
void 0 === b && (b = h.clone(), x[v] = b), h = b
}
return h.visible = n.visible, h.wireframe = n.wireframe, h.side = c === qo ? null !== n.shadowSide ? n.shadowSide : n.side : null !== n.shadowSide ? n.shadowSide : y[n.side], h.clipShadows = n.clipShadows, h.clippingPlanes = n.clippingPlanes, h.clipIntersection = n.clipIntersection, h.wireframeLinewidth = n.wireframeLinewidth, h.linewidth = n.linewidth, !0 === r.isPointLight && !0 === h.isMeshDistanceMaterial && (h.referencePosition.setFromMatrixPosition(r.matrixWorld), h.nearDistance = i, h.farDistance = s), h
}
function h(n, r, i, a, o) {
if (!1 !== n.visible) {
if (n.layers.test(r.layers) && (n.isMesh || n.isLine || n.isPoints) && (n.castShadow || n.receiveShadow && o === qo) && (!n.frustumCulled || u.intersectsObject(n))) {
n.modelViewMatrix.multiplyMatrices(i.matrixWorldInverse, n.matrixWorld);
var s = t.update(n),
c = n.material;
if (Array.isArray(c))
for (var p = s.groups, d = 0, f = p.length; d < f; d++) { var m=p[d], v=c[m.materialIndex]; if (v && v.visible) { var g=l(n, v, a, i.near, i.far, o); e.renderBufferDirect(i, null, s, g, n, m) } } else if (c.visible) { var g=l(n, c, a, i.near, i.far, o); e.renderBufferDirect(i, null, s, g, n, null) } } for (var y=n.children, x=0, b=y.length; x < b; x++) h(y[x], r, i, a, o) } } var u=new $, p=new n, d=new n, f=new s, m=[], v=[], g={}, y={ 0: Yo, 1: Xo, 2: Zo }, x=new X({ defines: { SAMPLE_RATE: .25, HALF_SAMPLE_RATE: 1 / 8 }, uniforms: { shadow_pass: { value: null }, resolution: { value: new n }, radius: { value: 4 } }, vertexShader: Su, fragmentShader: Mu }), b=x.clone(); b.defines.HORIZONAL_PASS=1; var w=new G; w.setAttribute("position", new L(new Float32Array([-1, -1, .5, 3, -1, .5, -1, 3, .5]), 3)); var _=new H(w, x), M=this; this.enabled=!1, this.autoUpdate=!0, this.needsUpdate=!1, this.type=ko, this.render=function(t, n, a) { if (!1 !==M.enabled && (!1 !==M.autoUpdate || !1 !==M.needsUpdate) && 0 !==t.length) { var o=e.getRenderTarget(), s=e.getActiveCubeFace(), l=e.getActiveMipmapLevel(), m=e.state; m.setBlending($o), m.buffers.color.setClear(1, 1, 1, 1), m.buffers.depth.setTest(!0), m.setScissorTest(!1); for (var v=0, g=t.length; v < g; v++) { var y=t[v], x=y.shadow; if (void 0 !==x) { p.copy(x.mapSize); var b=x.getFrameExtents(); if (p.multiply(b), d.copy(x.mapSize), (p.x> r || p.y > r) && (console.warn("THREE.WebGLShadowMap:", y, "has shadow exceeding max texture size, reducing"), p.x > r && (d.x = Math.floor(r / b.x), p.x = d.x * b.x, x.mapSize.x = d.x), p.y > r && (d.y = Math.floor(r / b.y), p.y = d.y * b.y, x.mapSize.y = d.y)), null === x.map && !x.isPointLightShadow && this.type === qo) {
var w = {
minFilter: Qs,
magFilter: Qs,
format: fc
};
x.map = new c(p.x, p.y, w), x.map.texture.name = y.name + ".shadowMap", x.mapPass = new c(p.x, p.y, w), x.camera.updateProjectionMatrix()
}
if (null === x.map) {
var w = {
minFilter: Ys,
magFilter: Ys,
format: fc
};
x.map = new c(p.x, p.y, w), x.map.texture.name = y.name + ".shadowMap", x.camera.updateProjectionMatrix()
}
e.setRenderTarget(x.map), e.clear();
for (var _ = x.getViewportCount(), S = 0; S < _; S++) { var T=x.getViewport(S); f.set(d.x * T.x, d.y * T.y, d.x * T.z, d.y * T.w), m.viewport(f), x.updateMatrices(y, S), u=x.getFrustum(), h(n, a, x.camera, y, this.type) } x.isPointLightShadow || this.type !==qo || i(x, a) } else console.warn("THREE.WebGLShadowMap:", y, "has no shadow." ) } M.needsUpdate=!1, e.setRenderTarget(o, s, l) } } } function Ht(e, t, n) { function r() { var t=!1, n=new s, r=null, i=new s(0, 0, 0, 0); return { setMask: function(n) { r===n || t || (e.colorMask(n, n, n, n), r=n) }, setLocked: function(e) { t=e }, setClear: function(t, r, a, o, s) { !0===s && (t *=o, r *=o, a *=o), n.set(t, r, a, o), !1===i.equals(n) && (e.clearColor(t, r, a, o), i.copy(n)) }, reset: function() { t=!1, r=null, i.set(-1, 0, 0, 0) } } } function i() { var t=!1, n=null, r=null, i=null; return { setTest: function(e) { e ? p(2929) : d(2929) }, setMask: function(r) { n===r || t || (e.depthMask(r), n=r) }, setFunc: function(t) { if (r !==t) { if (t) switch (t) { case ws: e.depthFunc(512); break; case _s: e.depthFunc(519); break; case Ms: e.depthFunc(513); break; case Ss: e.depthFunc(515); break; case Ts: e.depthFunc(514); break; case Es: e.depthFunc(518); break; case As: e.depthFunc(516); break; case Ls: e.depthFunc(517); break; default: e.depthFunc(515) } else e.depthFunc(515); r=t } }, setLocked: function(e) { t=e }, setClear: function(t) { i !==t && (e.clearDepth(t), i=t) }, reset: function() { t=!1, n=null, r=null, i=null } } } function a() { var t=!1, n=null, r=null, i=null, a=null, o=null, s=null, c=null, l=null; return { setTest: function(e) { t || (e ? p(2960) : d(2960)) }, setMask: function(r) { n===r || t || (e.stencilMask(r), n=r) }, setFunc: function(t, n, o) { r===t && i===n && a===o || (e.stencilFunc(t, n, o), r=t, i=n, a=o) }, setOp: function(t, n, r) { o===t && s===n && c===r || (e.stencilOp(t, n, r), o=t, s=n, c=r) }, setLocked: function(e) { t=e }, setClear: function(t) { l !==t && (e.clearStencil(t), l=t) }, reset: function() { t=!1, n=null, r=null, i=null, a=null, o=null, s=null, c=null, l=null } } } function o(t, n, r) { var i=new Uint8Array(4), a=e.createTexture(); e.bindTexture(t, a), e.texParameteri(t, 10241, 9728), e.texParameteri(t, 10240, 9728); for (var o=0; o < r; o++) e.texImage2D(n + o, 0, 6408, 1, 1, 0, 6408, 5121, i); return a } function c() { for (var e=0, t=z.length; e < t; e++) z[e]=0 } function l(e) { h(e, 0) } function h(n, r) { if (z[n]=1, 0===B[n] && (e.enableVertexAttribArray(n), B[n]=1), U[n] !==r) { (C ? e : t.get("ANGLE_instanced_arrays"))[C ? "vertexAttribDivisor" : "vertexAttribDivisorANGLE" ](n, r), U[n]=r } } function u() { for (var t=0, n=B.length; t !==n; ++t) B[t] !==z[t] && (e.disableVertexAttribArray(t), B[t]=0) } function p(t) { !0 !==F[t] && (e.enable(t), F[t]=!0) } function d(t) { !1 !==F[t] && (e.disable(t), F[t]=!1) } function f(t) { return G !==t && (e.useProgram(t), G=t, !0) } function m(t, n, r, i, a, o, s, c) { if (t===$o) return void(H && (d(3042), H=!1)); if (H || (p(3042), H=!0), t===is) a=a || n, o=o || r, s=s || i, n===j && a===q || (e.blendEquationSeparate(he[n], he[a]), j=n, q=a), r===k && i===W && o===X && s===Y || (e.blendFuncSeparate(pe[r], pe[i], pe[o], pe[s]), k=r, W=i, X=o, Y=s), V=t, Z=null; else if (t !==V || c !==Z) { if (j===as && q===as || (e.blendEquation(32774), j=as, q=as), c) switch (t) { case es: e.blendFuncSeparate(1, 771, 1, 771); break; case ts: e.blendFunc(1, 1); break; case ns: e.blendFuncSeparate(0, 0, 769, 771); break; case rs: e.blendFuncSeparate(0, 768, 0, 770); break; default: console.error("THREE.WebGLState: Invalid blending: ", t)
} else switch (t) {
case es:
e.blendFuncSeparate(770, 771, 1, 771);
break;
case ts:
e.blendFunc(770, 1);
break;
case ns:
e.blendFunc(0, 769);
break;
case rs:
e.blendFunc(0, 768);
break;
default:
console.error(" THREE.WebGLState: Invalid blending: ", t)
}
k = null, W = null, X = null, Y = null, V = t, Z = c
}
}
function v(e, t) {
e.side === Zo ? d(2884) : p(2884);
var n = e.side === Yo;
t && (n = !n), g(n), e.blending === es && !1 === e.transparent ? m($o) : m(e.blending, e.blendEquation, e.blendSrc, e.blendDst, e.blendEquationAlpha, e.blendSrcAlpha, e.blendDstAlpha, e.premultipliedAlpha), D.setFunc(e.depthFunc), D.setTest(e.depthTest), D.setMask(e.depthWrite), O.setMask(e.colorWrite);
var r = e.stencilWrite;
I.setTest(r), r && (I.setMask(e.stencilWriteMask), I.setFunc(e.stencilFunc, e.stencilRef, e.stencilFuncMask), I.setOp(e.stencilFail, e.stencilZFail, e.stencilZPass)), b(e.polygonOffset, e.polygonOffsetFactor, e.polygonOffsetUnits)
}
function g(t) {
J !== t && (t ? e.frontFace(2304) : e.frontFace(2305), J = t)
}
function y(t) {
t !== Ho ? (p(2884), t !== Q && (t === Vo ? e.cullFace(1029) : t === jo ? e.cullFace(1028) : e.cullFace(1032))) : d(2884), Q = t
}
function x(t) {
t !== K && (ne && e.lineWidth(t), K = t)
}
function b(t, n, r) {
t ? (p(32823), $ === n && ee === r || (e.polygonOffset(n, r), $ = n, ee = r)) : d(32823)
}
function w(e) {
e ? p(3089) : d(3089)
}
function _(t) {
void 0 === t && (t = 33984 + te - 1), ae !== t && (e.activeTexture(t), ae = t)
}
function M(t, n) {
null === ae && _();
var r = oe[ae];
void 0 === r && (r = {
type: void 0,
texture: void 0
}, oe[ae] = r), r.type === t && r.texture === n || (e.bindTexture(t, n || le[t]), r.type = t, r.texture = n)
}
function S() {
var t = oe[ae];
void 0 !== t && void 0 !== t.type && (e.bindTexture(t.type, null), t.type = void 0, t.texture = void 0)
}
function T() {
try {
e.compressedTexImage2D.apply(e, arguments)
} catch (e) {
console.error(" THREE.WebGLState:", e) } } function E() { try { e.texImage2D.apply(e, arguments) } catch (e) { console.error("THREE.WebGLState:", e) } } function A() { try { e.texImage3D.apply(e, arguments) } catch (e) { console.error("THREE.WebGLState:", e) } } function L(t) { !1===se.equals(t) && (e.scissor(t.x, t.y, t.z, t.w), se.copy(t)) } function R(t) { !1===ce.equals(t) && (e.viewport(t.x, t.y, t.z, t.w), ce.copy(t)) } function P() { for (var t=0; t < B.length; t++) 1===B[t] && (e.disableVertexAttribArray(t), B[t]=0); F={}, ae=null, oe={}, G=null, V=null, J=null, Q=null, O.reset(), D.reset(), I.reset() } var C=n.isWebGL2, O=new r, D=new i, I=new a, N=e.getParameter(34921), z=new Uint8Array(N), B=new Uint8Array(N), U=new Uint8Array(N), F={}, G=null, H=null, V=null, j=null, k=null, W=null, q=null, X=null, Y=null, Z=!1, J=null, Q=null, K=null, $=null, ee=null, te=e.getParameter(35661), ne=!1, re=0, ie=e.getParameter(7938); - 1 !==ie.indexOf("WebGL") ? (re=parseFloat(/^WebGL\ ([0-9])/.exec(ie)[1]), ne=re>= 1) : -1 !== ie.indexOf("OpenGL ES") && (re = parseFloat(/^OpenGL\ ES\ ([0-9])/.exec(ie)[1]), ne = re >= 2);
var ae = null,
oe = {},
se = new s,
ce = new s,
le = {};
le[3553] = o(3553, 3553, 1), le[34067] = o(34067, 34069, 6), O.setClear(0, 0, 0, 1), D.setClear(1), I.setClear(0), p(2929), D.setFunc(Ss), g(!1), y(Vo), p(2884), m($o);
var he = {};
if (he[as] = 32774, he[os] = 32778, he[ss] = 32779, C) he[cs] = 32775, he[ls] = 32776;
else {
var ue = t.get("EXT_blend_minmax");
null !== ue && (he[cs] = ue.MIN_EXT, he[ls] = ue.MAX_EXT)
}
var pe = {};
return pe[hs] = 0, pe[us] = 1, pe[ps] = 768, pe[fs] = 770, pe[bs] = 776, pe[ys] = 774, pe[vs] = 772, pe[ds] = 769, pe[ms] = 771, pe[xs] = 775, pe[gs] = 773, {
buffers: {
color: O,
depth: D,
stencil: I
},
initAttributes: c,
enableAttribute: l,
enableAttributeAndDivisor: h,
disableUnusedAttributes: u,
enable: p,
disable: d,
useProgram: f,
setBlending: m,
setMaterial: v,
setFlipSided: g,
setCullFace: y,
setLineWidth: x,
setPolygonOffset: b,
setScissorTest: w,
activeTexture: _,
bindTexture: M,
unbindTexture: S,
compressedTexImage2D: T,
texImage2D: E,
texImage3D: A,
scissor: L,
viewport: R,
reset: P
}
}
function Vt(e, t, n, r, i, a, o) {
function s(e, t) {
return X ? new OffscreenCanvas(e, t) : document.createElementNS("http://www.w3.org/1999/xhtml", "canvas")
}
function c(e, t, n, r) {
var i = 1;
if ((e.width > r || e.height > r) && (i = r / Math.max(e.width, e.height)), i < 1 || !0===t) { if ("undefined" !=typeof HTMLImageElement && e instanceof HTMLImageElement || "undefined" !=typeof HTMLCanvasElement && e instanceof HTMLCanvasElement || "undefined" !=typeof ImageBitmap && e instanceof ImageBitmap) { var a=t ? ll.floorPowerOfTwo : Math.floor, o=a(i * e.width), c=a(i * e.height); void 0===G && (G=s(o, c)); var l=n ? s(o, c) : G; l.width=o, l.height=c; return l.getContext("2d").drawImage(e, 0, 0, o, c), console.warn("THREE.WebGLRenderer: Texture has been resized from (" + e.width + "x" + e.height + ") to (" + o + "x" + c + ")." ), l } return "data" in e && console.warn("THREE.WebGLRenderer: Image in DataTexture is too big (" + e.width + "x" + e.height + ")." ), e } return e } function l(e) { return ll.isPowerOfTwo(e.width) && ll.isPowerOfTwo(e.height) } function h(e) { return !H && (e.wrapS !==qs || e.wrapT !==qs || e.minFilter !==Ys && e.minFilter !==Qs) } function u(e, t) { return e.generateMipmaps && t && e.minFilter !==Ys && e.minFilter !==Qs } function p(t, n, i, a) { e.generateMipmap(t), r.get(n).__maxMipLevel=Math.log(Math.max(i, a)) * Math.LOG2E } function d(e, n) { if (!1===H) return e; var r=e; return 6403===e && (5126===n && (r=33326), 5131===n && (r=33325), 5121===n && (r=33321)), 6407===e && (5126===n && (r=34837), 5131===n && (r=34843), 5121===n && (r=32849)), 6408===e && (5126===n && (r=34836), 5131===n && (r=34842), 5121===n && (r=32856)), 33325===r || 33326===r || 34842===r || 34836===r ? t.get("EXT_color_buffer_float") : 34843 !==r && 34837 !==r || console.warn("THREE.WebGLRenderer: Floating point textures with RGB format not supported. Please use RGBA instead."), r } function f(e) { return e===Ys || e===Zs || e===Js ? 9728 : 9729 } function m(e) { var t=e.target; t.removeEventListener("dispose", m), g(t), t.isVideoTexture && q.delete(t), o.memory.textures-- } function v(e) { var t=e.target; t.removeEventListener("dispose", v), y(t), o.memory.textures-- } function g(t) { var n=r.get(t); void 0 !==n.__webglInit && (e.deleteTexture(n.__webglTexture), r.remove(t)) } function y(t) { var n=r.get(t), i=r.get(t.texture); if (t) { if (void 0 !==i.__webglTexture && e.deleteTexture(i.__webglTexture), t.depthTexture && t.depthTexture.dispose(), t.isWebGLRenderTargetCube) for (var a=0; a < 6; a++) e.deleteFramebuffer(n.__webglFramebuffer[a]), n.__webglDepthbuffer && e.deleteRenderbuffer(n.__webglDepthbuffer[a]); else e.deleteFramebuffer(n.__webglFramebuffer), n.__webglDepthbuffer && e.deleteRenderbuffer(n.__webglDepthbuffer); if (t.isWebGLMultiviewRenderTarget) { e.deleteTexture(n.__webglColorTexture), e.deleteTexture(n.__webglDepthStencilTexture), o.memory.textures -=2; for (var a=0, s=n.__webglViewFramebuffers.length; a < s; a++) e.deleteFramebuffer(n.__webglViewFramebuffers[a]) } r.remove(t.texture), r.remove(t) } } function x() { Y=0 } function b() { var e=Y; return e>= V && console.warn("THREE.WebGLTextures: Trying to use " + e + " texture units while this GPU supports only " + V), Y += 1, e
}
function w(e, t) {
var i = r.get(e);
if (e.isVideoTexture && B(e), e.version > 0 && i.__version !== e.version) {
var a = e.image;
if (void 0 === a) console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");
else {
if (!1 !== a.complete) return void L(i, e, t);
console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")
}
}
n.activeTexture(33984 + t), n.bindTexture(3553, i.__webglTexture)
}
function _(e, t) {
var i = r.get(e);
if (e.version > 0 && i.__version !== e.version) return void L(i, e, t);
n.activeTexture(33984 + t), n.bindTexture(35866, i.__webglTexture)
}
function M(e, t) {
var i = r.get(e);
if (e.version > 0 && i.__version !== e.version) return void L(i, e, t);
n.activeTexture(33984 + t), n.bindTexture(32879, i.__webglTexture)
}
function S(t, i) {
if (6 === t.image.length) {
var o = r.get(t);
if (t.version > 0 && o.__version !== t.version) {
A(o, t), n.activeTexture(33984 + i), n.bindTexture(34067, o.__webglTexture), e.pixelStorei(37440, t.flipY);
for (var s = t && t.isCompressedTexture, h = t.image[0] && t.image[0].isDataTexture, f = [], m = 0; m < 6; m++) f[m]=s || h ? h ? t.image[m].image : t.image[m] : c(t.image[m], !1, !0, j); var v=f[0], g=l(v) || H, y=a.convert(t.format), x=a.convert(t.type), b=d(y, x); E(34067, t, g); var w; if (s) { for (var m=0; m < 6; m++) { w=f[m].mipmaps; for (var _=0; _ < w.length; _++) { var M=w[_]; t.format !==fc && t.format !==dc ? null !==y ? n.compressedTexImage2D(34069 + m, _, b, M.width, M.height, 0, M.data) : console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()") : n.texImage2D(34069 + m, _, b, M.width, M.height, 0, y, x, M.data) } } o.__maxMipLevel=w.length - 1 } else { w=t.mipmaps; for (var m=0; m < 6; m++) if (h) { n.texImage2D(34069 + m, 0, b, f[m].width, f[m].height, 0, y, x, f[m].data); for (var _=0; _ < w.length; _++) { var M=w[_], S=M.image[m].image; n.texImage2D(34069 + m, _ + 1, b, S.width, S.height, 0, y, x, S.data) } } else { n.texImage2D(34069 + m, 0, b, y, x, f[m]); for (var _=0; _ < w.length; _++) { var M=w[_]; n.texImage2D(34069 + m, _ + 1, b, y, x, M.image[m]) } } o.__maxMipLevel=w.length } u(t, g) && p(34067, t, v.width, v.height), o.__version=t.version, t.onUpdate && t.onUpdate(t) } else n.activeTexture(33984 + i), n.bindTexture(34067, o.__webglTexture) } } function T(e, t) { n.activeTexture(33984 + t), n.bindTexture(34067, r.get(e).__webglTexture) } function E(n, a, o) { o ? (e.texParameteri(n, 10242, Z[a.wrapS]), e.texParameteri(n, 10243, Z[a.wrapT]), 32879 !==n && 35866 !==n || e.texParameteri(n, 32882, Z[a.wrapR]), e.texParameteri(n, 10240, J[a.magFilter]), e.texParameteri(n, 10241, J[a.minFilter])) : (e.texParameteri(n, 10242, 33071), e.texParameteri(n, 10243, 33071), 32879 !==n && 35866 !==n || e.texParameteri(n, 32882, 33071), a.wrapS===qs && a.wrapT===qs || console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."), e.texParameteri(n, 10240, f(a.magFilter)), e.texParameteri(n, 10241, f(a.minFilter)), a.minFilter !==Ys && a.minFilter !==Qs && console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")); var s=t.get("EXT_texture_filter_anisotropic"); if (s) { if (a.type===oc && null===t.get("OES_texture_float_linear")) return; if (a.type===sc && null===(H || t.get("OES_texture_half_float_linear"))) return; (a.anisotropy> 1 || r.get(a).__currentAnisotropy) && (e.texParameterf(n, s.TEXTURE_MAX_ANISOTROPY_EXT, Math.min(a.anisotropy, i.getMaxAnisotropy())), r.get(a).__currentAnisotropy = a.anisotropy)
}
}
function A(t, n) {
void 0 === t.__webglInit && (t.__webglInit = !0, n.addEventListener("dispose", m), t.__webglTexture = e.createTexture(), o.memory.textures++)
}
function L(t, r, i) {
var o = 3553;
r.isDataTexture2DArray && (o = 35866), r.isDataTexture3D && (o = 32879), A(t, r), n.activeTexture(33984 + i), n.bindTexture(o, t.__webglTexture), e.pixelStorei(37440, r.flipY), e.pixelStorei(37441, r.premultiplyAlpha), e.pixelStorei(3317, r.unpackAlignment);
var s = h(r) && !1 === l(r.image),
f = c(r.image, s, !1, k),
m = l(f) || H,
v = a.convert(r.format),
g = a.convert(r.type),
y = d(v, g);
E(o, r, m);
var x, b = r.mipmaps;
if (r.isDepthTexture) {
if (y = 6402, r.type === oc) {
if (!1 === H) throw new Error("Float Depth Texture only supported in WebGL2.0");
y = 36012
} else H && (y = 33189);
r.format === yc && 6402 === y && r.type !== rc && r.type !== ac && (console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."), r.type = rc, g = a.convert(r.type)), r.format === xc && (y = 34041, r.type !== uc && (console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."), r.type = uc, g = a.convert(r.type))), n.texImage2D(3553, 0, y, f.width, f.height, 0, v, g, null)
} else if (r.isDataTexture)
if (b.length > 0 && m) {
for (var w = 0, _ = b.length; w < _; w++) x=b[w], n.texImage2D(3553, w, y, x.width, x.height, 0, v, g, x.data); r.generateMipmaps=!1, t.__maxMipLevel=b.length - 1 } else n.texImage2D(3553, 0, y, f.width, f.height, 0, v, g, f.data), t.__maxMipLevel=0; else if (r.isCompressedTexture) { for (var w=0, _=b.length; w < _; w++) x=b[w], r.format !==fc && r.format !==dc ? null !==v ? n.compressedTexImage2D(3553, w, y, x.width, x.height, 0, x.data) : console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()") : n.texImage2D(3553, w, y, x.width, x.height, 0, v, g, x.data); t.__maxMipLevel=b.length - 1 } else if (r.isDataTexture2DArray) n.texImage3D(35866, 0, y, f.width, f.height, f.depth, 0, v, g, f.data), t.__maxMipLevel=0; else if (r.isDataTexture3D) n.texImage3D(32879, 0, y, f.width, f.height, f.depth, 0, v, g, f.data), t.__maxMipLevel=0; else if (b.length> 0 && m) {
for (var w = 0, _ = b.length; w < _; w++) x=b[w], n.texImage2D(3553, w, y, v, g, x); r.generateMipmaps=!1, t.__maxMipLevel=b.length - 1 } else n.texImage2D(3553, 0, y, v, g, f), t.__maxMipLevel=0; u(r, m) && p(3553, r, f.width, f.height), t.__version=r.version, r.onUpdate && r.onUpdate(r) } function R(t, i, o, s) { var c=a.convert(i.texture.format), l=a.convert(i.texture.type), h=d(c, l); n.texImage2D(s, 0, h, i.width, i.height, 0, c, l, null), e.bindFramebuffer(36160, t), e.framebufferTexture2D(36160, o, s, r.get(i.texture).__webglTexture, 0), e.bindFramebuffer(36160, null) } function P(t, n, r) { if (e.bindRenderbuffer(36161, t), n.depthBuffer && !n.stencilBuffer) { if (r) { var i=z(n); e.renderbufferStorageMultisample(36161, i, 33189, n.width, n.height) } else e.renderbufferStorage(36161, 33189, n.width, n.height); e.framebufferRenderbuffer(36160, 36096, 36161, t) } else if (n.depthBuffer && n.stencilBuffer) { if (r) { var i=z(n); e.renderbufferStorageMultisample(36161, i, 35056, n.width, n.height) } else e.renderbufferStorage(36161, 34041, n.width, n.height); e.framebufferRenderbuffer(36160, 33306, 36161, t) } else { var o=a.convert(n.texture.format), s=a.convert(n.texture.type), c=d(o, s); if (r) { var i=z(n); e.renderbufferStorageMultisample(36161, i, c, n.width, n.height) } else e.renderbufferStorage(36161, c, n.width, n.height) } e.bindRenderbuffer(36161, null) } function C(t, n) { if (n && n.isWebGLRenderTargetCube) throw new Error("Depth Texture with cube render targets is not supported"); if (e.bindFramebuffer(36160, t), !n.depthTexture || !n.depthTexture.isDepthTexture) throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture"); r.get(n.depthTexture).__webglTexture && n.depthTexture.image.width===n.width && n.depthTexture.image.height===n.height || (n.depthTexture.image.width=n.width, n.depthTexture.image.height=n.height, n.depthTexture.needsUpdate=!0), w(n.depthTexture, 0); var i=r.get(n.depthTexture).__webglTexture; if (n.depthTexture.format===yc) e.framebufferTexture2D(36160, 36096, 3553, i, 0); else { if (n.depthTexture.format !==xc) throw new Error("Unknown depthTexture format"); e.framebufferTexture2D(36160, 33306, 3553, i, 0) } } function O(t) { var n=r.get(t), i=!0===t.isWebGLRenderTargetCube; if (t.depthTexture) { if (i) throw new Error("target.depthTexture not supported in Cube render targets"); C(n.__webglFramebuffer, t) } else if (i) { n.__webglDepthbuffer=[]; for (var a=0; a < 6; a++) e.bindFramebuffer(36160, n.__webglFramebuffer[a]), n.__webglDepthbuffer[a]=e.createRenderbuffer(), P(n.__webglDepthbuffer[a], t) } else e.bindFramebuffer(36160, n.__webglFramebuffer), n.__webglDepthbuffer=e.createRenderbuffer(), P(n.__webglDepthbuffer, t); e.bindFramebuffer(36160, null) } function D(i) { var s=r.get(i), c=r.get(i.texture); i.addEventListener("dispose", v), c.__webglTexture=e.createTexture(), o.memory.textures++; var h=!0===i.isWebGLRenderTargetCube, f=!0===i.isWebGLMultisampleRenderTarget, m=!0===i.isWebGLMultiviewRenderTarget, g=l(i) || H; if (h) { s.__webglFramebuffer=[]; for (var y=0; y < 6; y++) s.__webglFramebuffer[y]=e.createFramebuffer() } else if (s.__webglFramebuffer=e.createFramebuffer(), f) if (H) { s.__webglMultisampledFramebuffer=e.createFramebuffer(), s.__webglColorRenderbuffer=e.createRenderbuffer(), e.bindRenderbuffer(36161, s.__webglColorRenderbuffer); var x=a.convert(i.texture.format), b=a.convert(i.texture.type), w=d(x, b), _=z(i); e.renderbufferStorageMultisample(36161, _, w, i.width, i.height), e.bindFramebuffer(36160, s.__webglMultisampledFramebuffer), e.framebufferRenderbuffer(36160, 36064, 36161, s.__webglColorRenderbuffer), e.bindRenderbuffer(36161, null), i.depthBuffer && (s.__webglDepthRenderbuffer=e.createRenderbuffer(), P(s.__webglDepthRenderbuffer, i, !0)), e.bindFramebuffer(36160, null) } else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2."); else if (m) { var M=i.width, S=i.height, T=i.numViews; e.bindFramebuffer(36160, s.__webglFramebuffer); var A=t.get("OVR_multiview2"); o.memory.textures +=2; var L=e.createTexture(); e.bindTexture(35866, L), e.texParameteri(35866, 10240, 9728), e.texParameteri(35866, 10241, 9728), e.texImage3D(35866, 0, 32856, M, S, T, 0, 6408, 5121, null), A.framebufferTextureMultiviewOVR(36160, 36064, L, 0, 0, T); var C=e.createTexture(); e.bindTexture(35866, C), e.texParameteri(35866, 10240, 9728), e.texParameteri(35866, 10241, 9728), e.texImage3D(35866, 0, 35056, M, S, T, 0, 34041, 34042, null), A.framebufferTextureMultiviewOVR(36160, 33306, C, 0, 0, T); for (var D=new Array(T), y=0; y < T; ++y) D[y]=e.createFramebuffer(), e.bindFramebuffer(36160, D[y]), e.framebufferTextureLayer(36160, 36064, L, 0, y); s.__webglColorTexture=L, s.__webglDepthStencilTexture=C, s.__webglViewFramebuffers=D, e.bindFramebuffer(36160, null), e.bindTexture(35866, null) } if (h) { n.bindTexture(34067, c.__webglTexture), E(34067, i.texture, g); for (var y=0; y < 6; y++) R(s.__webglFramebuffer[y], i, 36064, 34069 + y); u(i.texture, g) && p(34067, i.texture, i.width, i.height), n.bindTexture(34067, null) } else m || (n.bindTexture(3553, c.__webglTexture), E(3553, i.texture, g), R(s.__webglFramebuffer, i, 36064, 3553), u(i.texture, g) && p(3553, i.texture, i.width, i.height), n.bindTexture(3553, null)); i.depthBuffer && O(i) } function I(e) { var t=e.texture; if (u(t, l(e) || H)) { var i=e.isWebGLRenderTargetCube ? 34067 : 3553, a=r.get(t).__webglTexture; n.bindTexture(i, a), p(i, t, e.width, e.height), n.bindTexture(i, null) } } function N(t) { if (t.isWebGLMultisampleRenderTarget) if (H) { var n=r.get(t); e.bindFramebuffer(36008, n.__webglMultisampledFramebuffer), e.bindFramebuffer(36009, n.__webglFramebuffer); var i=t.width, a=t.height, o=16384; t.depthBuffer && (o |=256), t.stencilBuffer && (o |=1024), e.blitFramebuffer(0, 0, i, a, 0, 0, i, a, o, 9728) } else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.") } function z(e) { return H && e.isWebGLMultisampleRenderTarget ? Math.min(W, e.samples) : 0 } function B(e) { var t=o.render.frame; q.get(e) !==t && (q.set(e, t), e.update()) } function U(e, t) { e && e.isWebGLRenderTarget && (!1===Q && (console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."), Q=!0), e=e.texture), w(e, t) } function F(e, t) { e && e.isWebGLRenderTargetCube && (!1===K && (console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."), K=!0), e=e.texture), e && e.isCubeTexture || Array.isArray(e.image) && 6===e.image.length ? S(e, t) : T(e, t) } var G, H=i.isWebGL2, V=i.maxTextures, j=i.maxCubemapSize, k=i.maxTextureSize, W=i.maxSamples, q=new WeakMap, X=!1; try { X="undefined" !=typeof OffscreenCanvas && null !==new OffscreenCanvas(1, 1).getContext("2d") } catch (e) {} var Y=0, Z={}; Z[Ws]=10497, Z[qs]=33071, Z[Xs]=33648; var J={}; J[Ys]=9728, J[Zs]=9984, J[Js]=9986, J[Qs]=9729, J[Ks]=9985, J[$s]=9987; var Q=!1, K=!1; this.allocateTextureUnit=b, this.resetTextureUnits=x, this.setTexture2D=w, this.setTexture2DArray=_, this.setTexture3D=M, this.setTextureCube=S, this.setTextureCubeDynamic=T, this.setupRenderTarget=D, this.updateRenderTargetMipmap=I, this.updateMultisampleRenderTarget=N, this.safeSetTexture2D=U, this.safeSetTextureCube=F } function jt(e, t, n) { function r(e) { var n; if (e===ec) return 5121; if (e===cc) return 32819; if (e===lc) return 32820; if (e===hc) return 33635; if (e===tc) return 5120; if (e===nc) return 5122; if (e===rc) return 5123; if (e===ic) return 5124; if (e===ac) return 5125; if (e===oc) return 5126; if (e===sc) return i ? 5131 : (n=t.get("OES_texture_half_float"), null !==n ? n.HALF_FLOAT_OES : null); if (e===pc) return 6406; if (e===dc) return 6407; if (e===fc) return 6408; if (e===mc) return 6409; if (e===vc) return 6410; if (e===yc) return 6402; if (e===xc) return 34041; if (e===bc) return 6403; if (e===wc || e===_c || e===Mc || e===Sc) { if (null===(n=t.get("WEBGL_compressed_texture_s3tc"))) return null; if (e===wc) return n.COMPRESSED_RGB_S3TC_DXT1_EXT; if (e===_c) return n.COMPRESSED_RGBA_S3TC_DXT1_EXT; if (e===Mc) return n.COMPRESSED_RGBA_S3TC_DXT3_EXT; if (e===Sc) return n.COMPRESSED_RGBA_S3TC_DXT5_EXT } if (e===Tc || e===Ec || e===Ac || e===Lc) { if (null===(n=t.get("WEBGL_compressed_texture_pvrtc"))) return null; if (e===Tc) return n.COMPRESSED_RGB_PVRTC_4BPPV1_IMG; if (e===Ec) return n.COMPRESSED_RGB_PVRTC_2BPPV1_IMG; if (e===Ac) return n.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG; if (e===Lc) return n.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG } return e===Rc ? (n=t.get("WEBGL_compressed_texture_etc1"), null !==n ? n.COMPRESSED_RGB_ETC1_WEBGL : null) : e===Pc || e===Cc || e===Oc || e===Dc || e===Ic || e===Nc || e===zc || e===Bc || e===Uc || e===Fc || e===Gc || e===Hc || e===Vc || e===jc ? (n=t.get("WEBGL_compressed_texture_astc"), null !==n ? e : null) : e===uc ? i ? 34042 : (n=t.get("WEBGL_depth_texture"), null !==n ? n.UNSIGNED_INT_24_8_WEBGL : null) : void 0 } var i=n.isWebGL2; return { convert: r } } function kt(e, t, n, r) { c.call(this, e, t, r), this.depthBuffer=!1, this.stencilBuffer=!1, this.numViews=n } function Wt(e, t) { function r() { if (void 0===w) { var e=M.get("OVR_multiview2"); if (w=null !==e && !1===t.getContextAttributes().antialias) { T=t.getParameter(e.MAX_VIEWS_OVR), m=new kt(0, 0, _), b=new n, y=[], g=[], x=[]; for (var r=0; r < T; r++) y[r]=new h, g[r]=new a } } return w } function i(e) { return e.isArrayCamera ? e.cameras : (x[0]=e, x) } function o(e, n) { for (var r=i(e), a=0; a < r.length; a++) y[a].copy(r[a].projectionMatrix); n.setValue(t, "projectionMatrices" , y) } function s(e, n) { for (var r=i(e), a=0; a < r.length; a++) y[a].copy(r[a].matrixWorldInverse); n.setValue(t, "viewMatrices" , y) } function c(e, n, r) { for (var a=i(n), o=0; o < a.length; o++) y[o].multiplyMatrices(a[o].matrixWorldInverse, e.matrixWorld), g[o].getNormalMatrix(y[o]); r.setValue(t, "modelViewMatrices" , y), r.setValue(t, "normalMatrices" , g) } function l(e) { if (void 0===e.isArrayCamera) return !0; var t=e.cameras; if (t.length> T) return !1;
for (var n = 1, r = t.length; n < r; n++) if (t[0].viewport.z !==t[n].viewport.z || t[0].viewport.w !==t[n].viewport.w) return !1; return !0 } function u(t) { if (v ? b.set(v.width, v.height) : e.getDrawingBufferSize(b), t.isArrayCamera) { var n=t.cameras[0].viewport; m.setSize(n.z, n.w), m.setNumViews(t.cameras.length) } else m.setSize(b.x, b.y), m.setNumViews(_) } function p(t) { !1 !==l(t) && (v=e.getRenderTarget(), u(t), e.setRenderTarget(m)) } function d(t) { m===e.getRenderTarget() && (e.setRenderTarget(v), f(t)) } function f(e) { var n=m, r=n.numViews, i=S.get(n).__webglViewFramebuffers, a=n.width, o=n.height; if (e.isArrayCamera) for (var s=0; s < r; s++) { var c=e.cameras[s].viewport, l=c.x, h=c.y, u=l + c.z, p=h + c.w; t.bindFramebuffer(36008, i[s]), t.blitFramebuffer(0, 0, a, o, l, h, u, p, 16384, 9728) } else t.bindFramebuffer(36008, i[0]), t.blitFramebuffer(0, 0, a, o, 0, 0, b.x, b.y, 16384, 9728) } var m, v, g, y, x, b, w, _=2, M=e.extensions, S=e.properties, T=0; this.isAvailable=r, this.attachCamera=p, this.detachCamera=d, this.updateCameraProjectionMatricesUniform=o, this.updateCameraViewMatricesUniform=s, this.updateObjectMatricesUniforms=c } function qt() { d.call(this), this.type="Group" } function Xt(e) { Z.call(this), this.cameras=e || [] } function Yt(e, t, n) { Tu.setFromMatrixPosition(t.matrixWorld), Eu.setFromMatrixPosition(n.matrixWorld); var r=Tu.distanceTo(Eu), i=t.projectionMatrix.elements, a=n.projectionMatrix.elements, o=i[14] / (i[10] - 1), s=i[14] / (i[10] + 1), c=(i[9] + 1) / i[5], l=(i[9] - 1) / i[5], h=(i[8] - 1) / i[0], u=(a[8] + 1) / a[0], p=o * h, d=o * u, f=r / (-h + u), m=f * -h; t.matrixWorld.decompose(e.position, e.quaternion, e.scale), e.translateX(m), e.translateZ(f), e.matrixWorld.compose(e.position, e.quaternion, e.scale), e.matrixWorldInverse.getInverse(e.matrixWorld); var v=o + f, g=s + f, y=p - m, x=d + (r - m), b=c * s / g * v, w=l * s / g * v; e.projectionMatrix.makePerspective(y, x, b, w, v, g) } function Zt(e) { function t() { return null !==f && !0===f.isPresenting } function a() { if (t()) { var n=f.getEyeParameters("left"); u=2 * n.renderWidth * b, p=n.renderHeight * b, L=e.getPixelRatio(), e.getSize(R), e.setDrawingBufferSize(u, p, 1), T.viewport.set(0, 0, u / 2, p), E.viewport.set(u / 2, 0, u / 2, p), O.start(), d.dispatchEvent({ type: "sessionstart" }) } else d.enabled && e.setDrawingBufferSize(R.width, R.height, L), O.stop(), d.dispatchEvent({ type: "sessionend" }) } function o(e) { for (var t=navigator.getGamepads && navigator.getGamepads(), n=0, r=t.length; n < r; n++) { var i=t[n]; if (i && ("Daydream Controller"===i.id || "Gear VR Controller"===i.id || "Oculus Go Controller"===i.id || "OpenVR Gamepad"===i.id || i.id.startsWith("Oculus Touch") || i.id.startsWith("HTC Vive Focus") || i.id.startsWith("Spatial Controller"))) { var a=i.hand; if (0===e && (""===a || "right"===a)) return i; if (1===e && "left"===a) return i } } } function c() { for (var e=0; e < g.length; e++) { var t=g[e], n=o(e); if (void 0 !==n && void 0 !==n.pose) { if (null===n.pose) return; var r=n.pose; !1===r.hasPosition && t.position.set(.2, -.6, -.05), null !==r.position && t.position.fromArray(r.position), null !==r.orientation && t.quaternion.fromArray(r.orientation), t.matrix.compose(t.position, t.quaternion, t.scale), t.matrix.premultiply(y), t.matrix.decompose(t.position, t.quaternion, t.scale), t.matrixWorldNeedsUpdate=!0, t.visible=!0; var i="Daydream Controller"===n.id ? 0 : 1; void 0===P[e] && (P[e]=!1), P[e] !==n.buttons[i].pressed && (P[e]=n.buttons[i].pressed, !0===P[e] ? t.dispatchEvent({ type: "selectstart" }) : (t.dispatchEvent({ type: "selectend" }), t.dispatchEvent({ type: "select" }))), i=2, void 0===C[e] && (C[e]=!1), void 0 !==n.buttons[i] && C[e] !==n.buttons[i].pressed && (C[e]=n.buttons[i].pressed, !0===C[e] ? t.dispatchEvent({ type: "squeezestart" }) : (t.dispatchEvent({ type: "squeezeend" }), t.dispatchEvent({ type: "squeeze" }))) } else t.visible=!1 } } function l(e, t) { null !==t && 4===t.length && e.set(t[0] * u, t[1] * p, t[2] * u, t[3] * p) } var u, p, d=this, f=null, m=null, v=null, g=[], y=new h, x=new h, b=1, w="local-floor" ; "undefined" !=typeof window && "VRFrameData" in window && (m=new window.VRFrameData, window.addEventListener("vrdisplaypresentchange", a, !1)); var _=new h, M=new r, S=new i, T=new Z; T.viewport=new s, T.layers.enable(1); var E=new Z; E.viewport=new s, E.layers.enable(2); var A=new Xt([T, E]); A.layers.enable(1), A.layers.enable(2); var L, R=new n, P=[], C=[]; this.enabled=!1, this.getController=function(e) { var t=g[e]; return void 0===t && (t=new qt, t.matrixAutoUpdate=!1, t.visible=!1, g[e]=t), t }, this.getDevice=function() { return f }, this.setDevice=function(e) { void 0 !==e && (f=e), O.setContext(e) }, this.setFramebufferScaleFactor=function(e) { b=e }, this.setReferenceSpaceType=function(e) { w=e }, this.setPoseTarget=function(e) { void 0 !==e && (v=e) }, this.getCamera=function(e) { var t="local-floor"===w ? 1.6 : 0; if (f.depthNear=e.near, f.depthFar=e.far, f.getFrameData(m), "local-floor"===w) { var n=f.stageParameters; n ? y.fromArray(n.sittingToStandingTransform) : y.makeTranslation(0, t, 0) } var r=m.pose, i=null !==v ? v : e; i.matrix.copy(y), i.matrix.decompose(i.position, i.quaternion, i.scale), null !==r.orientation && (M.fromArray(r.orientation), i.quaternion.multiply(M)), null !==r.position && (M.setFromRotationMatrix(y), S.fromArray(r.position), S.applyQuaternion(M), i.position.add(S)), i.updateMatrixWorld(); for (var a=i.children, o=0, s=a.length; o < s; o++) a[o].updateMatrixWorld(!0); T.near=e.near, E.near=e.near, T.far=e.far, E.far=e.far, T.matrixWorldInverse.fromArray(m.leftViewMatrix), E.matrixWorldInverse.fromArray(m.rightViewMatrix), x.getInverse(y), "local-floor"===w && (T.matrixWorldInverse.multiply(x), E.matrixWorldInverse.multiply(x)); var h=i.parent; null !==h && (_.getInverse(h.matrixWorld), T.matrixWorldInverse.multiply(_), E.matrixWorldInverse.multiply(_)), T.matrixWorld.getInverse(T.matrixWorldInverse), E.matrixWorld.getInverse(E.matrixWorldInverse), T.projectionMatrix.fromArray(m.leftProjectionMatrix), E.projectionMatrix.fromArray(m.rightProjectionMatrix), Yt(A, T, E); var u=f.getLayers(); if (u.length) { var p=u[0]; l(T.viewport, p.leftBounds), l(E.viewport, p.rightBounds) } return c(), A }, this.getStandingMatrix=function() { return y }, this.isPresenting=t; var O=new ee; this.setAnimationLoop=function(e) { O.setAnimationLoop(e), t() && O.start() }, this.submitFrame=function() { t() && f.submitFrame() }, this.dispose=function() { "undefined" !=typeof window && window.removeEventListener("vrdisplaypresentchange", a) }, this.setFrameOfReferenceType=function() { console.warn("THREE.WebVRManager: setFrameOfReferenceType() has been deprecated.") } } function Jt(e, t) { function n() { return null !==d && null !==f } function r(e) { for (var t=0; t < y.length; t++) x[t]===e.inputSource && y[t].dispatchEvent({ type: e.type }) } function i() { e.setFramebuffer(null), e.setRenderTarget(e.getRenderTarget()), E.stop(), p.dispatchEvent({ type: "sessionend" }) } function a(e) { f=e, E.setContext(d), E.start(), p.dispatchEvent({ type: "sessionstart" }) } function o() { for (var e=0; e < y.length; e++) x[e]=c(e) } function c(e) { for (var t=d.inputSources, n=0; n < t.length; n++) { var r=t[n], i=r.handedness; if (0===e && ("none"===i || "right"===i)) return r; if (1===e && "left"===i) return r } } function l(e, t) { null===t ? e.matrixWorld.copy(e.matrix) : e.matrixWorld.multiplyMatrices(t.matrixWorld, e.matrix), e.matrixWorldInverse.getInverse(e.matrixWorld) } function u(t, n) { if (null !==(v=n.getViewerPose(f))) { var r=v.views, i=d.renderState.baseLayer; e.setFramebuffer(i.framebuffer); for (var a=0; a < r.length; a++) { var o=r[a], s=i.getViewport(o), c=o.transform.inverse.matrix, l=_.cameras[a]; l.matrix.fromArray(c).getInverse(l.matrix), l.projectionMatrix.fromArray(o.projectionMatrix), l.viewport.set(s.x, s.y, s.width, s.height), 0===a && _.matrix.copy(l.matrix) } } for (var a=0; a < y.length; a++) { var h=y[a], u=x[a]; if (u) { var p=n.getPose(u.targetRaySpace, f); if (null !==p) { h.matrix.fromArray(p.transform.matrix), h.matrix.decompose(h.position, h.rotation, h.scale), h.visible=!0; continue } } h.visible=!1 } T && T(t, n) } var p=this, d=null, f=null, m="local-floor" , v=null, g=null, y=[], x=[], b=new Z; b.layers.enable(1), b.viewport=new s; var w=new Z; w.layers.enable(2), w.viewport=new s; var _=new Xt([b, w]); _.layers.enable(1), _.layers.enable(2); var M=null, S=null; this.enabled=!1, this.getController=function(e) { var t=y[e]; return void 0===t && (t=new qt, t.matrixAutoUpdate=!1, t.visible=!1, y[e]=t), t }, this.setFramebufferScaleFactor=function() {}, this.setReferenceSpaceType=function(e) { m=e }, this.getSession=function() { return d }, this.setSession=function(e) { null !==(d=e) && (d.addEventListener("select", r), d.addEventListener("selectstart", r), d.addEventListener("selectend", r), d.addEventListener("squeeze", r), d.addEventListener("squeezestart", r), d.addEventListener("squeezeend", r), d.addEventListener("end", i), d.updateRenderState({ baseLayer: new XRWebGLLayer(d, t, { antialias: t.getContextAttributes().antialias, alpha: t.getContextAttributes().alpha, depth: t.getContextAttributes().depth, stencil: t.getContextAttributes().stencil }) }), d.requestReferenceSpace(m).then(a), d.addEventListener("inputsourceschange", o), o()) }, this.setPoseTarget=function(e) { void 0 !==e && (g=e) }, this.getCamera=function(e) { _.near=w.near=b.near=e.near, _.far=w.far=b.far=e.far, M===_.near && S===_.far || (d.updateRenderState({ depthNear: _.near, depthFar: _.far }), M=_.near, S=_.far); var t=e.parent, n=_.cameras, r=g || e; l(_, t); for (var i=0; i < n.length; i++) l(n[i], t); r.matrixWorld.copy(_.matrixWorld); for (var a=r.children, i=0, o=a.length; i < o; i++) a[i].updateMatrixWorld(!0); return Yt(_, b, w), _ }, this.getCameraPose=function() { return v }, this.isPresenting=n; var T=null, E=new ee; E.setAnimationLoop(u), this.setAnimationLoop=function(e) { T=e }, this.dispose=function() {}, this.getStandingMatrix=function() { return console.warn("THREE.WebXRManager: getStandingMatrix() is no longer needed."), new h }, this.getDevice=function() { console.warn("THREE.WebXRManager: getDevice() has been deprecated.") }, this.setDevice=function() { console.warn("THREE.WebXRManager: setDevice() has been deprecated.") }, this.setFrameOfReferenceType=function() { console.warn("THREE.WebXRManager: setFrameOfReferenceType() has been deprecated.") }, this.submitFrame=function() {} } function Qt(e) { function t() { return null===ve ? Ae : 1 } function r() { Ue=new ce(J), Fe=new oe(J, Ue, e), !1===Fe.isWebGL2 && (Ue.get("WEBGL_depth_texture"), Ue.get("OES_texture_float"), Ue.get("OES_texture_half_float"), Ue.get("OES_texture_half_float_linear"), Ue.get("OES_standard_derivatives"), Ue.get("OES_element_index_uint"), Ue.get("ANGLE_instanced_arrays")), Ue.get("OES_texture_float_linear"), et=new jt(J, Ue, Fe), Ge=new Ht(J, Ue, Fe), Ge.scissor(Me.copy(Re).multiplyScalar(Ae).floor()), Ge.viewport(_e.copy(Le).multiplyScalar(Ae).floor()), He=new ue(J), Ve=new Lt, je=new Vt(J, Ue, Ge, Ve, Fe, et, He), ke=new te(J), We=new le(J, ke, He), qe=new fe(J, We, ke, He), Qe=new de(J), Xe=new At(Q, Ue, Fe), Ye=new Ot, Ze=new Bt, Je=new ie(Q, Ge, qe, j), Ke=new ae(J, Ue, He, Fe), $e=new he(J, Ue, He, Fe), He.programs=Xe.programs, Q.capabilities=Fe, Q.extensions=Ue, Q.properties=Ve, Q.renderLists=Ye, Q.state=Ge, Q.info=He } function a(e) { e.preventDefault(), console.log("THREE.WebGLRenderer: Context Lost."), ne=!0 } function o() { console.log("THREE.WebGLRenderer: Context Restored."), ne=!1, r() } function c(e) { var t=e.target; t.removeEventListener("dispose", c), l(t) } function l(e) { u(e), Ve.remove(e) } function u(e) { var t=Ve.get(e).program; e.program=void 0, void 0 !==t && Xe.releaseProgram(t) } function p(e, t) { e.render(function(e) { Q.renderBufferImmediate(e, t) }) } function d(e, t, n, r) { if (!1 !==Fe.isWebGL2 || !e.isInstancedMesh && !t.isInstancedBufferGeometry || null !==Ue.get("ANGLE_instanced_arrays")) { Ge.initAttributes(); var i=t.attributes, a=r.getAttributes(), o=n.defaultAttributeValues; for (var s in a) { var c=a[s]; if (c>= 0) {
var l = i[s];
if (void 0 !== l) {
var h = l.normalized,
u = l.itemSize,
p = ke.get(l);
if (void 0 === p) continue;
var d = p.buffer,
f = p.type,
m = p.bytesPerElement;
if (l.isInterleavedBufferAttribute) {
var v = l.data,
g = v.stride,
y = l.offset;
v && v.isInstancedInterleavedBuffer ? (Ge.enableAttributeAndDivisor(c, v.meshPerAttribute), void 0 === t.maxInstancedCount && (t.maxInstancedCount = v.meshPerAttribute * v.count)) : Ge.enableAttribute(c), J.bindBuffer(34962, d), J.vertexAttribPointer(c, u, f, h, g * m, y * m)
} else l.isInstancedBufferAttribute ? (Ge.enableAttributeAndDivisor(c, l.meshPerAttribute), void 0 === t.maxInstancedCount && (t.maxInstancedCount = l.meshPerAttribute * l.count)) : Ge.enableAttribute(c), J.bindBuffer(34962, d), J.vertexAttribPointer(c, u, f, h, 0, 0)
} else if ("instanceMatrix" === s) {
var p = ke.get(e.instanceMatrix);
if (void 0 === p) continue;
var d = p.buffer,
f = p.type;
Ge.enableAttributeAndDivisor(c + 0, 1), Ge.enableAttributeAndDivisor(c + 1, 1), Ge.enableAttributeAndDivisor(c + 2, 1), Ge.enableAttributeAndDivisor(c + 3, 1),
J.bindBuffer(34962, d), J.vertexAttribPointer(c + 0, 4, f, !1, 64, 0), J.vertexAttribPointer(c + 1, 4, f, !1, 64, 16), J.vertexAttribPointer(c + 2, 4, f, !1, 64, 32), J.vertexAttribPointer(c + 3, 4, f, !1, 64, 48)
} else if (void 0 !== o) {
var x = o[s];
if (void 0 !== x) switch (x.length) {
case 2:
J.vertexAttrib2fv(c, x);
break;
case 3:
J.vertexAttrib3fv(c, x);
break;
case 4:
J.vertexAttrib4fv(c, x);
break;
default:
J.vertexAttrib1fv(c, x)
}
}
}
}
Ge.disableUnusedAttributes()
}
}
function f(e) {
tt.isPresenting() || at && at(e)
}
function m(e, t, n, r) {
if (!1 !== e.visible) {
if (e.layers.test(t.layers))
if (e.isGroup) n = e.renderOrder;
else if (e.isLOD) !0 === e.autoUpdate && e.update(t);
else if (e.isLight) Z.pushLight(e), e.castShadow && Z.pushShadow(e);
else if (e.isSprite) {
if (!e.frustumCulled || Ce.intersectsSprite(e)) {
r && ze.setFromMatrixPosition(e.matrixWorld).applyMatrix4(Ne);
var i = qe.update(e),
a = e.material;
a.visible && Y.push(e, i, a, n, ze.z, null)
}
} else if (e.isImmediateRenderObject) r && ze.setFromMatrixPosition(e.matrixWorld).applyMatrix4(Ne), Y.push(e, null, e.material, n, ze.z, null);
else if ((e.isMesh || e.isLine || e.isPoints) && (e.isSkinnedMesh && e.skeleton.frame !== He.render.frame && (e.skeleton.update(), e.skeleton.frame = He.render.frame), !e.frustumCulled || Ce.intersectsObject(e))) {
r && ze.setFromMatrixPosition(e.matrixWorld).applyMatrix4(Ne);
var i = qe.update(e),
a = e.material;
if (Array.isArray(a))
for (var o = i.groups, s = 0, c = o.length; s < c; s++) { var l=o[s], h=a[l.materialIndex]; h && h.visible && Y.push(e, i, h, n, ze.z, l) } else a.visible && Y.push(e, i, a, n, ze.z, null) } for (var u=e.children, s=0, c=u.length; s < c; s++) m(u[s], t, n, r) } } function v(e, t, n, r) { for (var i=0, a=e.length; i < a; i++) { var o=e[i], s=o.object, c=o.geometry, l=void 0===r ? o.material : r, h=o.group; if (n.isArrayCamera) if (we=n, tt.enabled && nt.isAvailable()) g(s, t, n, c, l, h); else for (var u=n.cameras, p=0, d=u.length; p < d; p++) { var f=u[p]; s.layers.test(f.layers) && (Ge.viewport(_e.copy(f.viewport)), Z.setupLights(f), g(s, t, f, c, l, h)) } else we=null, g(s, t, n, c, l, h) } } function g(e, t, n, r, i, a) { if (e.onBeforeRender(Q, t, n, r, i, a), Z=Ze.get(t, we || n), e.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse, e.matrixWorld), e.normalMatrix.getNormalMatrix(e.modelViewMatrix), e.isImmediateRenderObject) { var o=x(n, t.fog, i, e); Ge.setMaterial(i), xe.geometry=null, xe.program=null, xe.wireframe=!1, p(e, o) } else Q.renderBufferDirect(n, t.fog, r, i, e, a); e.onAfterRender(Q, t, n, r, i, a), Z=Ze.get(t, we || n) } function y(e, t, n) { var r=Ve.get(e), i=Z.state.lights, a=Z.state.shadowsArray, o=i.state.version, s=Xe.getParameters(e, i.state, a, t, Oe.numPlanes, Oe.numIntersection, n), l=Xe.getProgramCacheKey(e, s), h=r.program, p=!0; if (void 0===h) e.addEventListener("dispose", c); else if (h.cacheKey !==l) u(e); else if (r.lightsStateVersion !==o) r.lightsStateVersion=o, p=!1; else { if (void 0 !==s.shaderID) return; p=!1 } if (p) { if (s.shaderID) { var d=cu[s.shaderID]; r.shader={ name: e.type, uniforms: W(d.uniforms), vertexShader: d.vertexShader, fragmentShader: d.fragmentShader } } else r.shader={ name: e.type, uniforms: e.uniforms, vertexShader: e.vertexShader, fragmentShader: e.fragmentShader }; e.onBeforeCompile(r.shader, Q), l=Xe.getProgramCacheKey(e, s), h=Xe.acquireProgram(e, r.shader, s, l), r.program=h, e.program=h } var f=h.getAttributes(); if (e.morphTargets) { e.numSupportedMorphTargets=0; for (var m=0; m < Q.maxMorphTargets; m++) f["morphTarget" + m]>= 0 && e.numSupportedMorphTargets++
}
if (e.morphNormals) {
e.numSupportedMorphNormals = 0;
for (var m = 0; m < Q.maxMorphNormals; m++) f["morphNormal" + m]>= 0 && e.numSupportedMorphNormals++
}
var v = r.shader.uniforms;
(e.isShaderMaterial || e.isRawShaderMaterial) && !0 !== e.clipping || (r.numClippingPlanes = Oe.numPlanes, r.numIntersection = Oe.numIntersection, v.clippingPlanes = Oe.uniform), r.fog = t, r.needsLights = z(e), r.lightsStateVersion = o, r.needsLights && (v.ambientLightColor.value = i.state.ambient, v.lightProbe.value = i.state.probe, v.directionalLights.value = i.state.directional, v.spotLights.value = i.state.spot, v.rectAreaLights.value = i.state.rectArea, v.pointLights.value = i.state.point, v.hemisphereLights.value = i.state.hemi, v.directionalShadowMap.value = i.state.directionalShadowMap, v.directionalShadowMatrix.value = i.state.directionalShadowMatrix, v.spotShadowMap.value = i.state.spotShadowMap, v.spotShadowMatrix.value = i.state.spotShadowMatrix, v.pointShadowMap.value = i.state.pointShadowMap, v.pointShadowMatrix.value = i.state.pointShadowMatrix);
var g = r.program.getUniforms(),
y = rt.seqWithValue(g.seq, v);
r.uniformsList = y
}
function x(e, t, n, r) {
je.resetTextureUnits();
var i = Ve.get(n),
a = Z.state.lights;
if (De && (Ie || e !== be)) {
var o = e === be && n.id === ye;
Oe.setState(n.clippingPlanes, n.clipIntersection, n.clipShadows, e, i, o)
}
n.version === i.__version && (void 0 === i.program ? n.needsUpdate = !0 : n.fog && i.fog !== t ? n.needsUpdate = !0 : i.needsLights && i.lightsStateVersion !== a.state.version ? n.needsUpdate = !0 : void 0 === i.numClippingPlanes || i.numClippingPlanes === Oe.numPlanes && i.numIntersection === Oe.numIntersection || (n.needsUpdate = !0)), n.version !== i.__version && (y(n, t, r), i.__version = n.version);
var s = !1,
c = !1,
l = !1,
h = i.program,
u = h.getUniforms(),
p = i.shader.uniforms;
if (Ge.useProgram(h.program) && (s = !0, c = !0, l = !0), n.id !== ye && (ye = n.id, c = !0), s || be !== e) {
if (h.numMultiviewViews > 0 ? nt.updateCameraProjectionMatricesUniform(e, u) : u.setValue(J, "projectionMatrix", e.projectionMatrix), Fe.logarithmicDepthBuffer && u.setValue(J, "logDepthBufFC", 2 / (Math.log(e.far + 1) / Math.LN2)), be !== e && (be = e, c = !0, l = !0), n.isShaderMaterial || n.isMeshPhongMaterial || n.isMeshToonMaterial || n.isMeshStandardMaterial || n.envMap) {
var d = u.map.cameraPosition;
void 0 !== d && d.setValue(J, ze.setFromMatrixPosition(e.matrixWorld))
}(n.isMeshPhongMaterial || n.isMeshToonMaterial || n.isMeshLambertMaterial || n.isMeshBasicMaterial || n.isMeshStandardMaterial || n.isShaderMaterial) && u.setValue(J, "isOrthographic", !0 === e.isOrthographicCamera), (n.isMeshPhongMaterial || n.isMeshToonMaterial || n.isMeshLambertMaterial || n.isMeshBasicMaterial || n.isMeshStandardMaterial || n.isShaderMaterial || n.skinning) && (h.numMultiviewViews > 0 ? nt.updateCameraViewMatricesUniform(e, u) : u.setValue(J, "viewMatrix", e.matrixWorldInverse))
}
if (n.skinning) {
u.setOptional(J, r, "bindMatrix"), u.setOptional(J, r, "bindMatrixInverse");
var f = r.skeleton;
if (f) {
var m = f.bones;
if (Fe.floatVertexTextures) {
if (void 0 === f.boneTexture) {
var v = Math.sqrt(4 * m.length);
v = ll.ceilPowerOfTwo(v), v = Math.max(v, 4);
var g = new Float32Array(v * v * 4);
g.set(f.boneMatrices);
var x = new K(g, v, v, fc, oc);
f.boneMatrices = g, f.boneTexture = x, f.boneTextureSize = v
}
u.setValue(J, "boneTexture", f.boneTexture, je), u.setValue(J, "boneTextureSize", f.boneTextureSize)
} else u.setOptional(J, f, "boneMatrices")
}
}
return (c || i.receiveShadow !== r.receiveShadow) && (i.receiveShadow = r.receiveShadow, u.setValue(J, "receiveShadow", r.receiveShadow)), c && (u.setValue(J, "toneMappingExposure", Q.toneMappingExposure), u.setValue(J, "toneMappingWhitePoint", Q.toneMappingWhitePoint), i.needsLights && N(p, l), t && n.fog && T(p, t), n.isMeshBasicMaterial ? b(p, n) : n.isMeshLambertMaterial ? (b(p, n), E(p, n)) : n.isMeshToonMaterial ? (b(p, n), L(p, n)) : n.isMeshPhongMaterial ? (b(p, n), A(p, n)) : n.isMeshStandardMaterial ? (b(p, n), n.isMeshPhysicalMaterial ? P(p, n) : R(p, n)) : n.isMeshMatcapMaterial ? (b(p, n), C(p, n)) : n.isMeshDepthMaterial ? (b(p, n), O(p, n)) : n.isMeshDistanceMaterial ? (b(p, n), D(p, n)) : n.isMeshNormalMaterial ? (b(p, n), I(p, n)) : n.isLineBasicMaterial ? (w(p, n), n.isLineDashedMaterial && _(p, n)) : n.isPointsMaterial ? M(p, n) : n.isSpriteMaterial ? S(p, n) : n.isShadowMaterial ? (p.color.value.copy(n.color), p.opacity.value = n.opacity) : n.envMap && b(p, n), void 0 !== p.ltc_1 && (p.ltc_1.value = su.LTC_1), void 0 !== p.ltc_2 && (p.ltc_2.value = su.LTC_2), rt.upload(J, i.uniformsList, p, je), n.isShaderMaterial && (n.uniformsNeedUpdate = !1)), n.isShaderMaterial && !0 === n.uniformsNeedUpdate && (rt.upload(J, i.uniformsList, p, je), n.uniformsNeedUpdate = !1), n.isSpriteMaterial && u.setValue(J, "center", r.center), h.numMultiviewViews > 0 ? nt.updateObjectMatricesUniforms(r, e, u) : (u.setValue(J, "modelViewMatrix", r.modelViewMatrix), u.setValue(J, "normalMatrix", r.normalMatrix)), u.setValue(J, "modelMatrix", r.matrixWorld), h
}
function b(e, t) {
e.opacity.value = t.opacity, t.color && e.diffuse.value.copy(t.color), t.emissive && e.emissive.value.copy(t.emissive).multiplyScalar(t.emissiveIntensity), t.map && (e.map.value = t.map), t.alphaMap && (e.alphaMap.value = t.alphaMap), t.specularMap && (e.specularMap.value = t.specularMap), t.envMap && (e.envMap.value = t.envMap, e.flipEnvMap.value = t.envMap.isCubeTexture ? -1 : 1, e.reflectivity.value = t.reflectivity, e.refractionRatio.value = t.refractionRatio, e.maxMipLevel.value = Ve.get(t.envMap).__maxMipLevel), t.lightMap && (e.lightMap.value = t.lightMap, e.lightMapIntensity.value = t.lightMapIntensity), t.aoMap && (e.aoMap.value = t.aoMap, e.aoMapIntensity.value = t.aoMapIntensity);
var n;
t.map ? n = t.map : t.specularMap ? n = t.specularMap : t.displacementMap ? n = t.displacementMap : t.normalMap ? n = t.normalMap : t.bumpMap ? n = t.bumpMap : t.roughnessMap ? n = t.roughnessMap : t.metalnessMap ? n = t.metalnessMap : t.alphaMap ? n = t.alphaMap : t.emissiveMap && (n = t.emissiveMap), void 0 !== n && (n.isWebGLRenderTarget && (n = n.texture), !0 === n.matrixAutoUpdate && n.updateMatrix(), e.uvTransform.value.copy(n.matrix));
var r;
t.aoMap ? r = t.aoMap : t.lightMap && (r = t.lightMap), void 0 !== r && (r.isWebGLRenderTarget && (r = r.texture), !0 === r.matrixAutoUpdate && r.updateMatrix(), e.uv2Transform.value.copy(r.matrix))
}
function w(e, t) {
e.diffuse.value.copy(t.color), e.opacity.value = t.opacity
}
function _(e, t) {
e.dashSize.value = t.dashSize, e.totalSize.value = t.dashSize + t.gapSize, e.scale.value = t.scale
}
function M(e, t) {
e.diffuse.value.copy(t.color), e.opacity.value = t.opacity, e.size.value = t.size * Ae, e.scale.value = .5 * Ee, t.map && (e.map.value = t.map), t.alphaMap && (e.alphaMap.value = t.alphaMap);
var n;
t.map ? n = t.map : t.alphaMap && (n = t.alphaMap), void 0 !== n && (!0 === n.matrixAutoUpdate && n.updateMatrix(), e.uvTransform.value.copy(n.matrix))
}
function S(e, t) {
e.diffuse.value.copy(t.color), e.opacity.value = t.opacity, e.rotation.value = t.rotation, t.map && (e.map.value = t.map), t.alphaMap && (e.alphaMap.value = t.alphaMap);
var n;
t.map ? n = t.map : t.alphaMap && (n = t.alphaMap), void 0 !== n && (!0 === n.matrixAutoUpdate && n.updateMatrix(), e.uvTransform.value.copy(n.matrix))
}
function T(e, t) {
e.fogColor.value.copy(t.color), t.isFog ? (e.fogNear.value = t.near, e.fogFar.value = t.far) : t.isFogExp2 && (e.fogDensity.value = t.density)
}
function E(e, t) {
t.emissiveMap && (e.emissiveMap.value = t.emissiveMap)
}
function A(e, t) {
e.specular.value.copy(t.specular), e.shininess.value = Math.max(t.shininess, 1e-4), t.emissiveMap && (e.emissiveMap.value = t.emissiveMap), t.bumpMap && (e.bumpMap.value = t.bumpMap, e.bumpScale.value = t.bumpScale, t.side === Yo && (e.bumpScale.value *= -1)), t.normalMap && (e.normalMap.value = t.normalMap, e.normalScale.value.copy(t.normalScale), t.side === Yo && e.normalScale.value.negate()), t.displacementMap && (e.displacementMap.value = t.displacementMap, e.displacementScale.value = t.displacementScale, e.displacementBias.value = t.displacementBias)
}
function L(e, t) {
e.specular.value.copy(t.specular), e.shininess.value = Math.max(t.shininess, 1e-4), t.gradientMap && (e.gradientMap.value = t.gradientMap), t.emissiveMap && (e.emissiveMap.value = t.emissiveMap), t.bumpMap && (e.bumpMap.value = t.bumpMap, e.bumpScale.value = t.bumpScale, t.side === Yo && (e.bumpScale.value *= -1)), t.normalMap && (e.normalMap.value = t.normalMap, e.normalScale.value.copy(t.normalScale), t.side === Yo && e.normalScale.value.negate()), t.displacementMap && (e.displacementMap.value = t.displacementMap, e.displacementScale.value = t.displacementScale, e.displacementBias.value = t.displacementBias)
}
function R(e, t) {
e.roughness.value = t.roughness, e.metalness.value = t.metalness, t.roughnessMap && (e.roughnessMap.value = t.roughnessMap), t.metalnessMap && (e.metalnessMap.value = t.metalnessMap), t.emissiveMap && (e.emissiveMap.value = t.emissiveMap), t.bumpMap && (e.bumpMap.value = t.bumpMap, e.bumpScale.value = t.bumpScale, t.side === Yo && (e.bumpScale.value *= -1)), t.normalMap && (e.normalMap.value = t.normalMap, e.normalScale.value.copy(t.normalScale), t.side === Yo && e.normalScale.value.negate()), t.displacementMap && (e.displacementMap.value = t.displacementMap, e.displacementScale.value = t.displacementScale, e.displacementBias.value = t.displacementBias), t.envMap && (e.envMapIntensity.value = t.envMapIntensity)
}
function P(e, t) {
R(e, t), e.reflectivity.value = t.reflectivity, e.clearcoat.value = t.clearcoat, e.clearcoatRoughness.value = t.clearcoatRoughness, t.sheen && e.sheen.value.copy(t.sheen), t.clearcoatNormalMap && (e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale), e.clearcoatNormalMap.value = t.clearcoatNormalMap, t.side === Yo && e.clearcoatNormalScale.value.negate()), e.transparency.value = t.transparency
}
function C(e, t) {
t.matcap && (e.matcap.value = t.matcap), t.bumpMap && (e.bumpMap.value = t.bumpMap, e.bumpScale.value = t.bumpScale, t.side === Yo && (e.bumpScale.value *= -1)), t.normalMap && (e.normalMap.value = t.normalMap, e.normalScale.value.copy(t.normalScale), t.side === Yo && e.normalScale.value.negate()), t.displacementMap && (e.displacementMap.value = t.displacementMap, e.displacementScale.value = t.displacementScale, e.displacementBias.value = t.displacementBias)
}
function O(e, t) {
t.displacementMap && (e.displacementMap.value = t.displacementMap, e.displacementScale.value = t.displacementScale, e.displacementBias.value = t.displacementBias)
}
function D(e, t) {
t.displacementMap && (e.displacementMap.value = t.displacementMap, e.displacementScale.value = t.displacementScale, e.displacementBias.value = t.displacementBias), e.referencePosition.value.copy(t.referencePosition), e.nearDistance.value = t.nearDistance, e.farDistance.value = t.farDistance
}
function I(e, t) {
t.bumpMap && (e.bumpMap.value = t.bumpMap, e.bumpScale.value = t.bumpScale, t.side === Yo && (e.bumpScale.value *= -1)), t.normalMap && (e.normalMap.value = t.normalMap, e.normalScale.value.copy(t.normalScale), t.side === Yo && e.normalScale.value.negate()), t.displacementMap && (e.displacementMap.value = t.displacementMap, e.displacementScale.value = t.displacementScale, e.displacementBias.value = t.displacementBias)
}
function N(e, t) {
e.ambientLightColor.needsUpdate = t, e.lightProbe.needsUpdate = t, e.directionalLights.needsUpdate = t, e.pointLights.needsUpdate = t, e.spotLights.needsUpdate = t, e.rectAreaLights.needsUpdate = t, e.hemisphereLights.needsUpdate = t
}
function z(e) {
return e.isMeshLambertMaterial || e.isMeshToonMaterial || e.isMeshPhongMaterial || e.isMeshStandardMaterial || e.isShadowMaterial || e.isShaderMaterial && !0 === e.lights
}
e = e || {};
var B = void 0 !== e.canvas ? e.canvas : document.createElementNS("http://www.w3.org/1999/xhtml", "canvas"),
U = void 0 !== e.context ? e.context : null,
F = void 0 !== e.alpha && e.alpha,
G = void 0 === e.depth || e.depth,
H = void 0 === e.stencil || e.stencil,
V = void 0 !== e.antialias && e.antialias,
j = void 0 === e.premultipliedAlpha || e.premultipliedAlpha,
k = void 0 !== e.preserveDrawingBuffer && e.preserveDrawingBuffer,
q = void 0 !== e.powerPreference ? e.powerPreference : "default",
X = void 0 !== e.failIfMajorPerformanceCaveat && e.failIfMajorPerformanceCaveat,
Y = null,
Z = null;
this.domElement = B, this.debug = {
checkShaderErrors: !0
}, this.autoClear = !0, this.autoClearColor = !0, this.autoClearDepth = !0, this.autoClearStencil = !0, this.sortObjects = !0, this.clippingPlanes = [], this.localClippingEnabled = !1, this.gammaFactor = 2, this.gammaOutput = !1, this.physicallyCorrectLights = !1, this.toneMapping = Ds, this.toneMappingExposure = 1, this.toneMappingWhitePoint = 1, this.maxMorphTargets = 8, this.maxMorphNormals = 4;
var J, Q = this,
ne = !1,
re = null,
pe = 0,
me = 0,
ve = null,
ge = null,
ye = -1,
xe = {
geometry: null,
program: null,
wireframe: !1
},
be = null,
we = null,
_e = new s,
Me = new s,
Se = null,
Te = B.width,
Ee = B.height,
Ae = 1,
Le = new s(0, 0, Te, Ee),
Re = new s(0, 0, Te, Ee),
Pe = !1,
Ce = new $,
Oe = new se,
De = !1,
Ie = !1,
Ne = new h,
ze = new i;
try {
var Be = {
alpha: F,
depth: G,
stencil: H,
antialias: V,
premultipliedAlpha: j,
preserveDrawingBuffer: k,
powerPreference: q,
failIfMajorPerformanceCaveat: X,
xrCompatible: !0
};
if (B.addEventListener("webglcontextlost", a, !1), B.addEventListener("webglcontextrestored", o, !1), null === (J = U || B.getContext("webgl", Be) || B.getContext("experimental-webgl", Be))) throw null !== B.getContext("webgl") ? new Error("Error creating WebGL context with your selected attributes.") : new Error("Error creating WebGL context.");
void 0 === J.getShaderPrecisionFormat && (J.getShaderPrecisionFormat = function() {
return {
rangeMin: 1,
rangeMax: 1,
precision: 1
}
})
} catch (e) {
throw console.error("THREE.WebGLRenderer: " + e.message), e
}
var Ue, Fe, Ge, He, Ve, je, ke, We, qe, Xe, Ye, Ze, Je, Qe, Ke, $e, et;
r();
var tt = "undefined" != typeof navigator && "xr" in navigator ? new Jt(Q, J) : new Zt(Q);
this.xr = tt;
var nt = new Wt(Q, J),
it = new Gt(Q, qe, Fe.maxTextureSize);
this.shadowMap = it, this.getContext = function() {
return J
}, this.getContextAttributes = function() {
return J.getContextAttributes()
}, this.forceContextLoss = function() {
var e = Ue.get("WEBGL_lose_context");
e && e.loseContext()
}, this.forceContextRestore = function() {
var e = Ue.get("WEBGL_lose_context");
e && e.restoreContext()
}, this.getPixelRatio = function() {
return Ae
}, this.setPixelRatio = function(e) {
void 0 !== e && (Ae = e, this.setSize(Te, Ee, !1))
}, this.getSize = function(e) {
return void 0 === e && (console.warn("WebGLRenderer: .getsize() now requires a Vector2 as an argument"), e = new n), e.set(Te, Ee)
}, this.setSize = function(e, t, n) {
if (tt.isPresenting()) return void console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");
Te = e, Ee = t, B.width = Math.floor(e * Ae), B.height = Math.floor(t * Ae), !1 !== n && (B.style.width = e + "px", B.style.height = t + "px"), this.setViewport(0, 0, e, t)
}, this.getDrawingBufferSize = function(e) {
return void 0 === e && (console.warn("WebGLRenderer: .getdrawingBufferSize() now requires a Vector2 as an argument"), e = new n), e.set(Te * Ae, Ee * Ae).floor()
}, this.setDrawingBufferSize = function(e, t, n) {
Te = e, Ee = t, Ae = n, B.width = Math.floor(e * n), B.height = Math.floor(t * n), this.setViewport(0, 0, e, t)
}, this.getCurrentViewport = function(e) {
return void 0 === e && (console.warn("WebGLRenderer: .getCurrentViewport() now requires a Vector4 as an argument"), e = new s), e.copy(_e)
}, this.getViewport = function(e) {
return e.copy(Le)
}, this.setViewport = function(e, t, n, r) {
e.isVector4 ? Le.set(e.x, e.y, e.z, e.w) : Le.set(e, t, n, r), Ge.viewport(_e.copy(Le).multiplyScalar(Ae).floor())
}, this.getScissor = function(e) {
return e.copy(Re)
}, this.setScissor = function(e, t, n, r) {
e.isVector4 ? Re.set(e.x, e.y, e.z, e.w) : Re.set(e, t, n, r), Ge.scissor(Me.copy(Re).multiplyScalar(Ae).floor())
}, this.getScissorTest = function() {
return Pe
}, this.setScissorTest = function(e) {
Ge.setScissorTest(Pe = e)
}, this.getClearColor = function() {
return Je.getClearColor()
}, this.setClearColor = function() {
Je.setClearColor.apply(Je, arguments)
}, this.getClearAlpha = function() {
return Je.getClearAlpha()
}, this.setClearAlpha = function() {
Je.setClearAlpha.apply(Je, arguments)
}, this.clear = function(e, t, n) {
var r = 0;
(void 0 === e || e) && (r |= 16384), (void 0 === t || t) && (r |= 256), (void 0 === n || n) && (r |= 1024), J.clear(r)
}, this.clearColor = function() {
this.clear(!0, !1, !1)
}, this.clearDepth = function() {
this.clear(!1, !0, !1)
}, this.clearStencil = function() {
this.clear(!1, !1, !0)
}, this.dispose = function() {
B.removeEventListener("webglcontextlost", a, !1), B.removeEventListener("webglcontextrestored", o, !1), Ye.dispose(), Ze.dispose(), Ve.dispose(), qe.dispose(), tt.dispose(), ot.stop()
}, this.renderBufferImmediate = function(e, t) {
Ge.initAttributes();
var n = Ve.get(e);
e.hasPositions && !n.position && (n.position = J.createBuffer()), e.hasNormals && !n.normal && (n.normal = J.createBuffer()), e.hasUvs && !n.uv && (n.uv = J.createBuffer()), e.hasColors && !n.color && (n.color = J.createBuffer());
var r = t.getAttributes();
e.hasPositions && (J.bindBuffer(34962, n.position), J.bufferData(34962, e.positionArray, 35048), Ge.enableAttribute(r.position), J.vertexAttribPointer(r.position, 3, 5126, !1, 0, 0)), e.hasNormals && (J.bindBuffer(34962, n.normal), J.bufferData(34962, e.normalArray, 35048), Ge.enableAttribute(r.normal), J.vertexAttribPointer(r.normal, 3, 5126, !1, 0, 0)), e.hasUvs && (J.bindBuffer(34962, n.uv), J.bufferData(34962, e.uvArray, 35048), Ge.enableAttribute(r.uv), J.vertexAttribPointer(r.uv, 2, 5126, !1, 0, 0)), e.hasColors && (J.bindBuffer(34962, n.color), J.bufferData(34962, e.colorArray, 35048), Ge.enableAttribute(r.color), J.vertexAttribPointer(r.color, 3, 5126, !1, 0, 0)), Ge.disableUnusedAttributes(), J.drawArrays(4, 0, e.count), e.count = 0
}, this.renderBufferDirect = function(e, n, r, i, a, o) {
var s = a.isMesh && a.matrixWorld.determinant() < 0, c=x(e, n, i, a); Ge.setMaterial(i, s); var l=!1; xe.geometry===r.id && xe.program===c.id && xe.wireframe===(!0===i.wireframe) || (xe.geometry=r.id, xe.program=c.id, xe.wireframe=!0===i.wireframe, l=!0), (i.morphTargets || i.morphNormals) && (Qe.update(a, r, i, c), l=!0); var h=r.index, u=r.attributes.position; if ((null===h || 0 !==h.count) && void 0 !==u && 0 !==u.count) { var p=1; !0===i.wireframe && (h=We.getWireframeAttribute(r), p=2); var f, m=Ke; null !==h && (f=ke.get(h), m=$e, m.setIndex(f)), l && (d(a, r, i, c), null !==h && J.bindBuffer(34963, f.buffer)); var v=null !==h ? h.count : u.count, g=r.drawRange.start * p, y=r.drawRange.count * p, b=null !==o ? o.start * p : 0, w=null !==o ? o.count * p : 1 / 0, _=Math.max(g, b), M=Math.min(v, g + y, b + w) - 1, S=Math.max(0, M - _ + 1); if (0 !==S) { if (a.isMesh) !0===i.wireframe ? (Ge.setLineWidth(i.wireframeLinewidth * t()), m.setMode(1)) : m.setMode(4); else if (a.isLine) { var T=i.linewidth; void 0===T && (T=1), Ge.setLineWidth(T * t()), a.isLineSegments ? m.setMode(1) : a.isLineLoop ? m.setMode(2) : m.setMode(3) } else a.isPoints ? m.setMode(0) : a.isSprite && m.setMode(4); a.isInstancedMesh ? m.renderInstances(r, _, S, a.count) : r.isInstancedBufferGeometry ? m.renderInstances(r, _, S, r.maxInstancedCount) : m.render(_, S) } } }, this.compile=function(e, t) { Z=Ze.get(e, t), Z.init(), e.traverse(function(e) { e.isLight && (Z.pushLight(e), e.castShadow && Z.pushShadow(e)) }), Z.setupLights(t), e.traverse(function(t) { if (t.material) if (Array.isArray(t.material)) for (var n=0; n < t.material.length; n++) y(t.material[n], e.fog, t); else y(t.material, e.fog, t) }) }; var at=null, ot=new ee; ot.setAnimationLoop(f), "undefined" !=typeof window && ot.setContext(window), this.setAnimationLoop=function(e) { at=e, tt.setAnimationLoop(e), ot.start() }, this.render=function(e, t) { var n, r; if (void 0 !==arguments[2] && (console.warn("THREE.WebGLRenderer.render(): the renderTarget argument has been removed. Use .setRenderTarget() instead."), n=arguments[2]), void 0 !==arguments[3] && (console.warn("THREE.WebGLRenderer.render(): the forceClear argument has been removed. Use .clear() instead."), r=arguments[3]), !t || !t.isCamera) return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera."); if (!ne) { xe.geometry=null, xe.program=null, xe.wireframe=!1, ye=-1, be=null, !0===e.autoUpdate && e.updateMatrixWorld(), null===t.parent && t.updateMatrixWorld(), tt.enabled && tt.isPresenting() && (t=tt.getCamera(t)), Z=Ze.get(e, t), Z.init(), e.onBeforeRender(Q, e, t, n || ve), Ne.multiplyMatrices(t.projectionMatrix, t.matrixWorldInverse), Ce.setFromMatrix(Ne), Ie=this.localClippingEnabled, De=Oe.init(this.clippingPlanes, Ie, t), Y=Ye.get(e, t), Y.init(), m(e, t, 0, Q.sortObjects), !0===Q.sortObjects && Y.sort(), De && Oe.beginShadows(); var i=Z.state.shadowsArray; it.render(i, e, t), Z.setupLights(t), De && Oe.endShadows(), this.info.autoReset && this.info.reset(), void 0 !==n && this.setRenderTarget(n), tt.enabled && nt.isAvailable() && nt.attachCamera(t), Je.render(Y, e, t, r); var a=Y.opaque, o=Y.transparent; if (e.overrideMaterial) { var s=e.overrideMaterial; a.length && v(a, e, t, s), o.length && v(o, e, t, s) } else a.length && v(a, e, t), o.length && v(o, e, t); e.onAfterRender(Q, e, t), null !==ve && (je.updateRenderTargetMipmap(ve), je.updateMultisampleRenderTarget(ve)), Ge.buffers.depth.setTest(!0), Ge.buffers.depth.setMask(!0), Ge.buffers.color.setMask(!0), Ge.setPolygonOffset(!1), tt.enabled && (nt.isAvailable() && nt.detachCamera(t), tt.submitFrame()), Y=null, Z=null } }, this.setTexture2D=function() { var e=!1; return function(t, n) { t && t.isWebGLRenderTarget && (e || (console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."), e=!0), t=t.texture), je.setTexture2D(t, n) } }(), this.setFramebuffer=function(e) { re !==e && null===ve && J.bindFramebuffer(36160, e), re=e }, this.getActiveCubeFace=function() { return pe }, this.getActiveMipmapLevel=function() { return me }, this.getRenderTarget=function() { return ve }, this.setRenderTarget=function(e, t, n) { ve=e, pe=t, me=n, e && void 0===Ve.get(e).__webglFramebuffer && je.setupRenderTarget(e); var r=re, i=!1; if (e) { var a=Ve.get(e).__webglFramebuffer; e.isWebGLRenderTargetCube ? (r=a[t || 0], i=!0) : r=e.isWebGLMultisampleRenderTarget ? Ve.get(e).__webglMultisampledFramebuffer : a, _e.copy(e.viewport), Me.copy(e.scissor), Se=e.scissorTest } else _e.copy(Le).multiplyScalar(Ae).floor(), Me.copy(Re).multiplyScalar(Ae).floor(), Se=Pe; if (ge !==r && (J.bindFramebuffer(36160, r), ge=r), Ge.viewport(_e), Ge.scissor(Me), Ge.setScissorTest(Se), i) { var o=Ve.get(e.texture); J.framebufferTexture2D(36160, 36064, 34069 + (t || 0), o.__webglTexture, n || 0) } }, this.readRenderTargetPixels=function(e, t, n, r, i, a, o) { if (!e || !e.isWebGLRenderTarget) return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget."); var s=Ve.get(e).__webglFramebuffer; if (e.isWebGLRenderTargetCube && void 0 !==o && (s=s[o]), s) { var c=!1; s !==ge && (J.bindFramebuffer(36160, s), c=!0); try { var l=e.texture, h=l.format, u=l.type; if (h !==fc && et.convert(h) !==J.getParameter(35739)) return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format."); if (!(u===ec || et.convert(u)===J.getParameter(35738) || u===oc && (Fe.isWebGL2 || Ue.get("OES_texture_float") || Ue.get("WEBGL_color_buffer_float")) || u===sc && (Fe.isWebGL2 ? Ue.get("EXT_color_buffer_float") : Ue.get("EXT_color_buffer_half_float")))) return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type."); 36053===J.checkFramebufferStatus(36160) ? t>= 0 && t <= e.width - r && n>= 0 && n <= e.height - i && J.readPixels(t, n, r, i, et.convert(h), et.convert(u), a) : console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.") } finally { c && J.bindFramebuffer(36160, ge) } } }, this.copyFramebufferToTexture=function(e, t, n) { void 0===n && (n=0); var r=Math.pow(2, -n), i=Math.floor(t.image.width * r), a=Math.floor(t.image.height * r), o=et.convert(t.format); je.setTexture2D(t, 0), J.copyTexImage2D(3553, n, o, e.x, e.y, i, a, 0), Ge.unbindTexture() }, this.copyTextureToTexture=function(e, t, n, r) { var i=t.image.width, a=t.image.height, o=et.convert(n.format), s=et.convert(n.type); je.setTexture2D(n, 0), t.isDataTexture ? J.texSubImage2D(3553, r || 0, e.x, e.y, i, a, o, s, t.image.data) : J.texSubImage2D(3553, r || 0, e.x, e.y, o, s, t.image), Ge.unbindTexture() }, this.initTexture=function(e) { je.setTexture2D(e, 0), Ge.unbindTexture() }, "undefined" !=typeof __THREE_DEVTOOLS__ && __THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe", { detail: this })) } function Kt(e, t) { this.name="" , this.color=new w(e), this.density=void 0 !==t ? t : 25e-5 } function $t(e, t, n) { this.name="" , this.color=new w(e), this.near=void 0 !==t ? t : 1, this.far=void 0 !==n ? n : 1e3 } function en(e, t) { this.array=e, this.stride=t, this.count=void 0 !==e ? e.length / t : 0, this.usage=ol, this.updateRange={ offset: 0, count: -1 }, this.version=0 } function tn(e, t, n, r) { this.data=e, this.itemSize=t, this.offset=n, this.normalized=!0===r } function nn(e) { E.call(this), this.type="SpriteMaterial" , this.color=new w(16777215), this.map=null, this.alphaMap=null, this.rotation=0, this.sizeAttenuation=!0, this.transparent=!0, this.setValues(e) } function rn(e) { if (d.call(this), this.type="Sprite" , void 0===Au) { Au=new G; var t=new Float32Array([-.5, -.5, 0, 0, 0, .5, -.5, 0, 1, 0, .5, .5, 0, 1, 1, -.5, .5, 0, 0, 1]), r=new en(t, 5); Au.setIndex([0, 1, 2, 0, 2, 3]), Au.setAttribute("position", new tn(r, 3, 0, !1)), Au.setAttribute("uv", new tn(r, 2, 3, !1)) } this.geometry=Au, this.material=void 0 !==e ? e : new nn, this.center=new n(.5, .5) } function an(e, t, n, r, i, a) { Cu.subVectors(e, n).addScalar(.5).multiply(r), void 0 !==i ? (Ou.x=a * Cu.x - i * Cu.y, Ou.y=i * Cu.x + a * Cu.y) : Ou.copy(Cu), e.copy(t), e.x +=Ou.x, e.y +=Ou.y, e.applyMatrix4(Du) } function on() { d.call(this), this.type="LOD" , Object.defineProperties(this, { levels: { enumerable: !0, value: [] } }), this.autoUpdate=!0 } function sn(e, t) { e && e.isGeometry && console.error("THREE.SkinnedMesh no longer supports THREE.Geometry. Use THREE.BufferGeometry instead."), H.call(this, e, t), this.type="SkinnedMesh" , this.bindMode="attached" , this.bindMatrix=new h, this.bindMatrixInverse=new h } function cn(e, t) { if (e=e || [], this.bones=e.slice(0), this.boneMatrices=new Float32Array(16 * this.bones.length), this.frame=-1, void 0===t) this.calculateInverses(); else if (this.bones.length===t.length) this.boneInverses=t.slice(0); else { console.warn("THREE.Skeleton boneInverses is the wrong length."), this.boneInverses=[]; for (var n=0, r=this.bones.length; n < r; n++) this.boneInverses.push(new h) } } function ln() { d.call(this), this.type="Bone" } function hn(e, t, n) { H.call(this, e, t), this.instanceMatrix=new L(new Float32Array(16 * n), 16), this.count=n } function un(e) { E.call(this), this.type="LineBasicMaterial" , this.color=new w(16777215), this.linewidth=1, this.linecap="round" , this.linejoin="round" , this.setValues(e) } function pn(e, t, n) { 1===n && console.error("THREE.Line: parameter THREE.LinePieces no longer supported. Use THREE.LineSegments instead."), d.call(this), this.type="Line" , this.geometry=void 0 !==e ? e : new G, this.material=void 0 !==t ? t : new un({ color: 16777215 * Math.random() }) } function dn(e, t) { pn.call(this, e, t), this.type="LineSegments" } function fn(e, t) { pn.call(this, e, t), this.type="LineLoop" } function mn(e) { E.call(this), this.type="PointsMaterial" , this.color=new w(16777215), this.map=null, this.alphaMap=null, this.size=1, this.sizeAttenuation=!0, this.morphTargets=!1, this.setValues(e) } function vn(e, t) { d.call(this), this.type="Points" , this.geometry=void 0 !==e ? e : new G, this.material=void 0 !==t ? t : new mn({ color: 16777215 * Math.random() }), this.updateMorphTargets() } function gn(e, t, n, r, a, o, s) { var c=np.distanceSqToPoint(e); if (c < n) { var l=new i; np.closestPointToPoint(e, l), l.applyMatrix4(r); var h=a.ray.origin.distanceTo(l); if (h < a.near || h> a.far) return;
o.push({
distance: h,
distanceToRay: Math.sqrt(c),
point: l,
index: t,
face: null,
object: s
})
}
}
function yn(e, t, n, r, i, a, s, c, l) {
o.call(this, e, t, n, r, i, a, s, c, l), this.format = void 0 !== s ? s : dc, this.minFilter = void 0 !== a ? a : Qs, this.magFilter = void 0 !== i ? i : Qs, this.generateMipmaps = !1
}
function xn(e, t, n, r, i, a, s, c, l, h, u, p) {
o.call(this, null, a, s, c, l, h, r, i, u, p), this.image = {
width: t,
height: n
}, this.mipmaps = e, this.flipY = !1, this.generateMipmaps = !1
}
function bn(e, t, n, r, i, a, s, c, l) {
o.call(this, e, t, n, r, i, a, s, c, l), this.needsUpdate = !0
}
function wn(e, t, n, r, i, a, s, c, l, h) {
if ((h = void 0 !== h ? h : yc) !== yc && h !== xc) throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");
void 0 === n && h === yc && (n = rc), void 0 === n && h === xc && (n = uc), o.call(this, null, r, i, a, s, c, h, n, l), this.image = {
width: e,
height: t
}, this.magFilter = void 0 !== s ? s : Ys, this.minFilter = void 0 !== c ? c : Ys, this.flipY = !1, this.generateMipmaps = !1
}
function _n(e) {
G.call(this), this.type = "WireframeGeometry";
var t, n, r, a, o, s, c, l, h, u, p = [],
d = [0, 0],
f = {},
m = ["a", "b", "c"];
if (e && e.isGeometry) {
var v = e.faces;
for (t = 0, r = v.length; t < r; t++) { var g=v[t]; for (n=0; n < 3; n++) c=g[m[n]], l=g[m[(n + 1) % 3]], d[0]=Math.min(c, l), d[1]=Math.max(c, l), h=d[0] + "," + d[1], void 0===f[h] && (f[h]={ index1: d[0], index2: d[1] }) } for (h in f) s=f[h], u=e.vertices[s.index1], p.push(u.x, u.y, u.z), u=e.vertices[s.index2], p.push(u.x, u.y, u.z) } else if (e && e.isBufferGeometry) { var y, x, b, w, _, M, S, T; if (u=new i, null !==e.index) { for (y=e.attributes.position, x=e.index, b=e.groups, 0===b.length && (b=[{ start: 0, count: x.count, materialIndex: 0 }]), a=0, o=b.length; a < o; ++a) for (w=b[a], _=w.start, M=w.count, t=_, r=_ + M; t < r; t +=3) for (n=0; n < 3; n++) c=x.getX(t + n), l=x.getX(t + (n + 1) % 3), d[0]=Math.min(c, l), d[1]=Math.max(c, l), h=d[0] + "," + d[1], void 0===f[h] && (f[h]={ index1: d[0], index2: d[1] }); for (h in f) s=f[h], u.fromBufferAttribute(y, s.index1), p.push(u.x, u.y, u.z), u.fromBufferAttribute(y, s.index2), p.push(u.x, u.y, u.z) } else for (y=e.attributes.position, t=0, r=y.count / 3; t < r; t++) for (n=0; n < 3; n++) S=3 * t + n, u.fromBufferAttribute(y, S), p.push(u.x, u.y, u.z), T=3 * t + (n + 1) % 3, u.fromBufferAttribute(y, T), p.push(u.x, u.y, u.z) } this.setAttribute("position", new z(p, 3)) } function Mn(e, t, n) { k.call(this), this.type="ParametricGeometry" , this.parameters={ func: e, slices: t, stacks: n }, this.fromBufferGeometry(new Sn(e, t, n)), this.mergeVertices() } function Sn(e, t, n) { G.call(this), this.type="ParametricBufferGeometry" , this.parameters={ func: e, slices: t, stacks: n }; var r, a, o=[], s=[], c=[], l=[], h=new i, u=new i, p=new i, d=new i, f=new i; e.length < 3 && console.error("THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter."); var m=t + 1; for (r=0; r <=n; r++) { var v=r / n; for (a=0; a <=t; a++) { var g=a / t; e(g, v, u), s.push(u.x, u.y, u.z), g - 1e-5>= 0 ? (e(g - 1e-5, v, p), d.subVectors(u, p)) : (e(g + 1e-5, v, p), d.subVectors(p, u)), v - 1e-5 >= 0 ? (e(g, v - 1e-5, p), f.subVectors(u, p)) : (e(g, v + 1e-5, p), f.subVectors(p, u)), h.crossVectors(d, f).normalize(), c.push(h.x, h.y, h.z), l.push(g, v)
}
}
for (r = 0; r < n; r++) for (a=0; a < t; a++) { var y=r * m + a, x=r * m + a + 1, b=(r + 1) * m + a + 1, w=(r + 1) * m + a; o.push(y, x, w), o.push(x, b, w) } this.setIndex(o), this.setAttribute("position", new z(s, 3)), this.setAttribute("normal", new z(c, 3)), this.setAttribute("uv", new z(l, 2)) } function Tn(e, t, n, r) { k.call(this), this.type="PolyhedronGeometry" , this.parameters={ vertices: e, indices: t, radius: n, detail: r }, this.fromBufferGeometry(new En(e, t, n, r)), this.mergeVertices() } function En(e, t, r, a) { function o(e, t, n, r) { var i, a, o=Math.pow(2, r), s=[]; for (i=0; i <=o; i++) { s[i]=[]; var l=e.clone().lerp(n, i / o), h=t.clone().lerp(n, i / o), u=o - i; for (a=0; a <=u; a++) s[i][a]=0===a && i===o ? l : l.clone().lerp(h, a / u) } for (i=0; i < o; i++) for (a=0; a < 2 * (o - i) - 1; a++) { var p=Math.floor(a / 2); a % 2==0 ? (c(s[i][p + 1]), c(s[i + 1][p]), c(s[i][p])) : (c(s[i][p + 1]), c(s[i + 1][p + 1]), c(s[i + 1][p])) } } function s() { for (var e=0; e < m.length; e +=6) { var t=m[e + 0], n=m[e + 2], r=m[e + 4], i=Math.max(t, n, r), a=Math.min(t, n, r); i> .9 && a < .1 && (t < .2 && (m[e + 0] +=1), n < .2 && (m[e + 2] +=1), r < .2 && (m[e + 4] +=1)) } } function c(e) { f.push(e.x, e.y, e.z) } function l(t, n) { var r=3 * t; n.x=e[r + 0], n.y=e[r + 1], n.z=e[r + 2] } function h() { for (var e=new i, t=new i, r=new i, a=new i, o=new n, s=new n, c=new n, l=0, h=0; l < f.length; l +=9, h +=6) { e.set(f[l + 0], f[l + 1], f[l + 2]), t.set(f[l + 3], f[l + 4], f[l + 5]), r.set(f[l + 6], f[l + 7], f[l + 8]), o.set(m[h + 0], m[h + 1]), s.set(m[h + 2], m[h + 3]), c.set(m[h + 4], m[h + 5]), a.copy(e).add(t).add(r).divideScalar(3); var d=p(a); u(o, h + 0, e, d), u(s, h + 2, t, d), u(c, h + 4, r, d) } } function u(e, t, n, r) { r < 0 && 1===e.x && (m[t]=e.x - 1), 0===n.x && 0===n.z && (m[t]=r / 2 / Math.PI + .5) } function p(e) { return Math.atan2(e.z, -e.x) } function d(e) { return Math.atan2(-e.y, Math.sqrt(e.x * e.x + e.z * e.z)) } G.call(this), this.type="PolyhedronBufferGeometry" , this.parameters={ vertices: e, indices: t, radius: r, detail: a }, r=r || 1, a=a || 0; var f=[], m=[]; ! function(e) { for (var n=new i, r=new i, a=new i, s=0; s < t.length; s +=3) l(t[s + 0], n), l(t[s + 1], r), l(t[s + 2], a), o(n, r, a, e) }(a), function(e) { for (var t=new i, n=0; n < f.length; n +=3) t.x=f[n + 0], t.y=f[n + 1], t.z=f[n + 2], t.normalize().multiplyScalar(e), f[n + 0]=t.x, f[n + 1]=t.y, f[n + 2]=t.z }(r), function() { for (var e=new i, t=0; t < f.length; t +=3) { e.x=f[t + 0], e.y=f[t + 1], e.z=f[t + 2]; var n=p(e) / 2 / Math.PI + .5, r=d(e) / Math.PI + .5; m.push(n, 1 - r) } h(), s() }(), this.setAttribute("position", new z(f, 3)), this.setAttribute("normal", new z(f.slice(), 3)), this.setAttribute("uv", new z(m, 2)), 0===a ? this.computeVertexNormals() : this.normalizeNormals() } function An(e, t) { k.call(this), this.type="TetrahedronGeometry" , this.parameters={ radius: e, detail: t }, this.fromBufferGeometry(new Ln(e, t)), this.mergeVertices() } function Ln(e, t) { var n=[1, 1, 1, -1, -1, 1, -1, 1, -1, 1, -1, -1], r=[2, 1, 0, 0, 3, 2, 1, 3, 0, 2, 3, 1]; En.call(this, n, r, e, t), this.type="TetrahedronBufferGeometry" , this.parameters={ radius: e, detail: t } } function Rn(e, t) { k.call(this), this.type="OctahedronGeometry" , this.parameters={ radius: e, detail: t }, this.fromBufferGeometry(new Pn(e, t)), this.mergeVertices() } function Pn(e, t) { var n=[1, 0, 0, -1, 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 1, 0, 0, -1], r=[0, 2, 4, 0, 4, 3, 0, 3, 5, 0, 5, 2, 1, 2, 5, 1, 5, 3, 1, 3, 4, 1, 4, 2]; En.call(this, n, r, e, t), this.type="OctahedronBufferGeometry" , this.parameters={ radius: e, detail: t } } function Cn(e, t) { k.call(this), this.type="IcosahedronGeometry" , this.parameters={ radius: e, detail: t }, this.fromBufferGeometry(new On(e, t)), this.mergeVertices() } function On(e, t) { var n=(1 + Math.sqrt(5)) / 2, r=[-1, n, 0, 1, n, 0, -1, -n, 0, 1, -n, 0, 0, -1, n, 0, 1, n, 0, -1, -n, 0, 1, -n, n, 0, -1, n, 0, 1, -n, 0, -1, -n, 0, 1], i=[0, 11, 5, 0, 5, 1, 0, 1, 7, 0, 7, 10, 0, 10, 11, 1, 5, 9, 5, 11, 4, 11, 10, 2, 10, 7, 6, 7, 1, 8, 3, 9, 4, 3, 4, 2, 3, 2, 6, 3, 6, 8, 3, 8, 9, 4, 9, 5, 2, 4, 11, 6, 2, 10, 8, 6, 7, 9, 8, 1]; En.call(this, r, i, e, t), this.type="IcosahedronBufferGeometry" , this.parameters={ radius: e, detail: t } } function Dn(e, t) { k.call(this), this.type="DodecahedronGeometry" , this.parameters={ radius: e, detail: t }, this.fromBufferGeometry(new In(e, t)), this.mergeVertices() } function In(e, t) { var n=(1 + Math.sqrt(5)) / 2, r=1 / n, i=[-1, -1, -1, -1, -1, 1, -1, 1, -1, -1, 1, 1, 1, -1, -1, 1, -1, 1, 1, 1, -1, 1, 1, 1, 0, -r, -n, 0, -r, n, 0, r, -n, 0, r, n, -r, -n, 0, -r, n, 0, r, -n, 0, r, n, 0, -n, 0, -r, n, 0, -r, -n, 0, r, n, 0, r], a=[3, 11, 7, 3, 7, 15, 3, 15, 13, 7, 19, 17, 7, 17, 6, 7, 6, 15, 17, 4, 8, 17, 8, 10, 17, 10, 6, 8, 0, 16, 8, 16, 2, 8, 2, 10, 0, 12, 1, 0, 1, 18, 0, 18, 16, 6, 10, 2, 6, 2, 13, 6, 13, 15, 2, 16, 18, 2, 18, 3, 2, 3, 13, 18, 1, 9, 18, 9, 11, 18, 11, 3, 4, 14, 12, 4, 12, 0, 4, 0, 8, 11, 9, 5, 11, 5, 19, 11, 19, 7, 19, 5, 14, 19, 14, 4, 19, 4, 17, 1, 12, 14, 1, 14, 5, 1, 5, 9]; En.call(this, i, a, e, t), this.type="DodecahedronBufferGeometry" , this.parameters={ radius: e, detail: t } } function Nn(e, t, n, r, i, a) { k.call(this), this.type="TubeGeometry" , this.parameters={ path: e, tubularSegments: t, radius: n, radialSegments: r, closed: i }, void 0 !==a && console.warn("THREE.TubeGeometry: taper has been removed."); var o=new zn(e, t, n, r, i); this.tangents=o.tangents, this.normals=o.normals, this.binormals=o.binormals, this.fromBufferGeometry(o), this.mergeVertices() } function zn(e, t, r, a, o) { function s(n) { v=e.getPointAt(n / t, v); var i=h.normals[n], o=h.binormals[n]; for (p=0; p <=a; p++) { var s=p / a * Math.PI * 2, c=Math.sin(s), l=-Math.cos(s); f.x=l * i.x + c * o.x, f.y=l * i.y + c * o.y, f.z=l * i.z + c * o.z, f.normalize(), y.push(f.x, f.y, f.z), d.x=v.x + r * f.x, d.y=v.y + r * f.y, d.z=v.z + r * f.z, g.push(d.x, d.y, d.z) } } function c() { for (p=1; p <=t; p++) for (u=1; u <=a; u++) { var e=(a + 1) * (p - 1) + (u - 1), n=(a + 1) * p + (u - 1), r=(a + 1) * p + u, i=(a + 1) * (p - 1) + u; b.push(e, n, i), b.push(n, r, i) } } function l() { for (u=0; u <=t; u++) for (p=0; p <=a; p++) m.x=u / t, m.y=p / a, x.push(m.x, m.y) } G.call(this), this.type="TubeBufferGeometry" , this.parameters={ path: e, tubularSegments: t, radius: r, radialSegments: a, closed: o }, t=t || 64, r=r || 1, a=a || 8, o=o || !1; var h=e.computeFrenetFrames(t, o); this.tangents=h.tangents, this.normals=h.normals, this.binormals=h.binormals; var u, p, d=new i, f=new i, m=new n, v=new i, g=[], y=[], x=[], b=[]; ! function() { for (u=0; u < t; u++) s(u); s(!1===o ? t : 0), l(), c() }(), this.setIndex(b), this.setAttribute("position", new z(g, 3)), this.setAttribute("normal", new z(y, 3)), this.setAttribute("uv", new z(x, 2)) } function Bn(e, t, n, r, i, a, o) { k.call(this), this.type="TorusKnotGeometry" , this.parameters={ radius: e, tube: t, tubularSegments: n, radialSegments: r, p: i, q: a }, void 0 !==o && console.warn("THREE.TorusKnotGeometry: heightScale has been deprecated. Use .scale( x, y, z ) instead."), this.fromBufferGeometry(new Un(e, t, n, r, i, a)), this.mergeVertices() } function Un(e, t, n, r, a, o) { function s(e, t, n, r, i) { var a=Math.cos(e), o=Math.sin(e), s=n / t * e, c=Math.cos(s); i.x=r * (2 + c) * .5 * a, i.y=r * (2 + c) * o * .5, i.z=r * Math.sin(s) * .5 } G.call(this), this.type="TorusKnotBufferGeometry" , this.parameters={ radius: e, tube: t, tubularSegments: n, radialSegments: r, p: a, q: o }, e=e || 1, t=t || .4, n=Math.floor(n) || 64, r=Math.floor(r) || 8, a=a || 2, o=o || 3; var c, l, h=[], u=[], p=[], d=[], f=new i, m=new i, v=new i, g=new i, y=new i, x=new i, b=new i; for (c=0; c <=n; ++c) { var w=c / n * a * Math.PI * 2; for (s(w, a, o, e, v), s(w + .01, a, o, e, g), x.subVectors(g, v), b.addVectors(g, v), y.crossVectors(x, b), b.crossVectors(y, x), y.normalize(), b.normalize(), l=0; l <=r; ++l) { var _=l / r * Math.PI * 2, M=-t * Math.cos(_), S=t * Math.sin(_); f.x=v.x + (M * b.x + S * y.x), f.y=v.y + (M * b.y + S * y.y), f.z=v.z + (M * b.z + S * y.z), u.push(f.x, f.y, f.z), m.subVectors(f, v).normalize(), p.push(m.x, m.y, m.z), d.push(c / n), d.push(l / r) } } for (l=1; l <=n; l++) for (c=1; c <=r; c++) { var T=(r + 1) * (l - 1) + (c - 1), E=(r + 1) * l + (c - 1), A=(r + 1) * l + c, L=(r + 1) * (l - 1) + c; h.push(T, E, L), h.push(E, A, L) } this.setIndex(h), this.setAttribute("position", new z(u, 3)), this.setAttribute("normal", new z(p, 3)), this.setAttribute("uv", new z(d, 2)) } function Fn(e, t, n, r, i) { k.call(this), this.type="TorusGeometry" , this.parameters={ radius: e, tube: t, radialSegments: n, tubularSegments: r, arc: i }, this.fromBufferGeometry(new Gn(e, t, n, r, i)), this.mergeVertices() } function Gn(e, t, n, r, a) { G.call(this), this.type="TorusBufferGeometry" , this.parameters={ radius: e, tube: t, radialSegments: n, tubularSegments: r, arc: a }, e=e || 1, t=t || .4, n=Math.floor(n) || 8, r=Math.floor(r) || 6, a=a || 2 * Math.PI; var o, s, c=[], l=[], h=[], u=[], p=new i, d=new i, f=new i; for (o=0; o <=n; o++) for (s=0; s <=r; s++) { var m=s / r * a, v=o / n * Math.PI * 2; d.x=(e + t * Math.cos(v)) * Math.cos(m), d.y=(e + t * Math.cos(v)) * Math.sin(m), d.z=t * Math.sin(v), l.push(d.x, d.y, d.z), p.x=e * Math.cos(m), p.y=e * Math.sin(m), f.subVectors(d, p).normalize(), h.push(f.x, f.y, f.z), u.push(s / r), u.push(o / n) } for (o=1; o <=n; o++) for (s=1; s <=r; s++) { var g=(r + 1) * o + s - 1, y=(r + 1) * (o - 1) + s - 1, x=(r + 1) * (o - 1) + s, b=(r + 1) * o + s; c.push(g, y, b), c.push(y, x, b) } this.setIndex(c), this.setAttribute("position", new z(l, 3)), this.setAttribute("normal", new z(h, 3)), this.setAttribute("uv", new z(u, 2)) } function Hn(e, t, n, r, i) { var a, o; if (i===fr(e, t, n, r)> 0)
for (a = t; a < n; a +=r) o=ur(a, e[a], e[a + 1], o); else for (a=n - r; a>= t; a -= r) o = ur(a, e[a], e[a + 1], o);
return o && ar(o, o.next) && (pr(o), o = o.next), o
}
function Vn(e, t) {
if (!e) return e;
t || (t = e);
var n, r = e;
do {
if (n = !1, r.steiner || !ar(r, r.next) && 0 !== ir(r.prev, r, r.next)) r = r.next;
else {
if (pr(r), (r = t = r.prev) === r.next) break;
n = !0
}
} while (n || r !== t);
return t
}
function jn(e, t, n, r, i, a, o) {
if (e) {
!o && a && Kn(e, r, i, a);
for (var s, c, l = e; e.prev !== e.next;)
if (s = e.prev, c = e.next, a ? Wn(e, r, i, a) : kn(e)) t.push(s.i / n), t.push(e.i / n), t.push(c.i / n), pr(e), e = c.next, l = c.next;
else if ((e = c) === l) {
o ? 1 === o ? (e = qn(e, t, n), jn(e, t, n, r, i, a, 2)) : 2 === o && Xn(e, t, n, r, i, a) : jn(Vn(e), t, n, r, i, a, 1);
break
}
}
}
function kn(e) {
var t = e.prev,
n = e,
r = e.next;
if (ir(t, n, r) >= 0) return !1;
for (var i = e.next.next; i !== e.prev;) {
if (nr(t.x, t.y, n.x, n.y, r.x, r.y, i.x, i.y) && ir(i.prev, i, i.next) >= 0) return !1;
i = i.next
}
return !0
}
function Wn(e, t, n, r) {
var i = e.prev,
a = e,
o = e.next;
if (ir(i, a, o) >= 0) return !1;
for (var s = i.x < a.x ? i.x < o.x ? i.x : o.x : a.x < o.x ? a.x : o.x, c=i.y < a.y ? i.y < o.y ? i.y : o.y : a.y < o.y ? a.y : o.y, l=i.x> a.x ? i.x > o.x ? i.x : o.x : a.x > o.x ? a.x : o.x, h = i.y > a.y ? i.y > o.y ? i.y : o.y : a.y > o.y ? a.y : o.y, u = er(s, c, t, n, r), p = er(l, h, t, n, r), d = e.prevZ, f = e.nextZ; d && d.z >= u && f && f.z <= p;) { if (d !==e.prev && d !==e.next && nr(i.x, i.y, a.x, a.y, o.x, o.y, d.x, d.y) && ir(d.prev, d, d.next)>= 0) return !1;
if (d = d.prevZ, f !== e.prev && f !== e.next && nr(i.x, i.y, a.x, a.y, o.x, o.y, f.x, f.y) && ir(f.prev, f, f.next) >= 0) return !1;
f = f.nextZ
}
for (; d && d.z >= u;) {
if (d !== e.prev && d !== e.next && nr(i.x, i.y, a.x, a.y, o.x, o.y, d.x, d.y) && ir(d.prev, d, d.next) >= 0) return !1;
d = d.prevZ
}
for (; f && f.z <= p;) { if (f !==e.prev && f !==e.next && nr(i.x, i.y, a.x, a.y, o.x, o.y, f.x, f.y) && ir(f.prev, f, f.next)>= 0) return !1;
f = f.nextZ
}
return !0
}
function qn(e, t, n) {
var r = e;
do {
var i = r.prev,
a = r.next.next;
!ar(i, a) && or(i, r, r.next, a) && cr(i, a) && cr(a, i) && (t.push(i.i / n), t.push(r.i / n), t.push(a.i / n), pr(r), pr(r.next), r = e = a), r = r.next
} while (r !== e);
return r
}
function Xn(e, t, n, r, i, a) {
var o = e;
do {
for (var s = o.next.next; s !== o.prev;) {
if (o.i !== s.i && rr(o, s)) {
var c = hr(o, s);
return o = Vn(o, o.next), c = Vn(c, c.next), jn(o, t, n, r, i, a), void jn(c, t, n, r, i, a)
}
s = s.next
}
o = o.next
} while (o !== e)
}
function Yn(e, t, n, r) {
var i, a, o, s, c, l = [];
for (i = 0, a = t.length; i < a; i++) o=t[i] * r, s=i < a - 1 ? t[i + 1] * r : e.length, c=Hn(e, o, s, r, !1), c===c.next && (c.steiner=!0), l.push(tr(c)); for (l.sort(Zn), i=0; i < l.length; i++) Jn(l[i], n), n=Vn(n, n.next); return n } function Zn(e, t) { return e.x - t.x } function Jn(e, t) { if (t=Qn(e, t)) { var n=hr(t, e); Vn(n, n.next) } } function Qn(e, t) { var n, r=t, i=e.x, a=e.y, o=-1 / 0; do { if (a <=r.y && a>= r.next.y && r.next.y !== r.y) {
var s = r.x + (a - r.y) * (r.next.x - r.x) / (r.next.y - r.y);
if (s <= i && s> o) {
if (o = s, s === i) {
if (a === r.y) return r;
if (a === r.next.y) return r.next
}
n = r.x < r.next.x ? r : r.next } } r=r.next } while (r !==t); if (!n) return null; if (i===o) return n.prev; var c, l=n, h=n.x, u=n.y, p=1 / 0; for (r=n.next; r !==l;) i>= r.x && r.x >= h && i !== r.x && nr(a < u ? i : o, a, h, u, a < u ? o : i, a, r.x, r.y) && ((c=Math.abs(a - r.y) / (i - r.x)) < p || c===p && r.x> n.x) && cr(r, e) && (n = r, p = c), r = r.next;
return n
}
function Kn(e, t, n, r) {
var i = e;
do {
null === i.z && (i.z = er(i.x, i.y, t, n, r)), i.prevZ = i.prev, i.nextZ = i.next, i = i.next
} while (i !== e);
i.prevZ.nextZ = null, i.prevZ = null, $n(i)
}
function $n(e) {
var t, n, r, i, a, o, s, c, l = 1;
do {
for (n = e, e = null, a = null, o = 0; n;) {
for (o++, r = n, s = 0, t = 0; t < l && (s++, r=r.nextZ); t++); for (c=l; s> 0 || c > 0 && r;) 0 !== s && (0 === c || !r || n.z <= r.z) ? (i=n, n=n.nextZ, s--) : (i=r, r=r.nextZ, c--), a ? a.nextZ=i : e=i, i.prevZ=a, a=i; n=r } a.nextZ=null, l *=2 } while (o> 1);
return e
}
function er(e, t, n, r, i) {
return e = 32767 * (e - n) * i, t = 32767 * (t - r) * i, e = 16711935 & (e | e << 8), e=252645135 & (e | e << 4), e=858993459 & (e | e << 2), e=1431655765 & (e | e << 1), t=16711935 & (t | t << 8), t=252645135 & (t | t << 4), t=858993459 & (t | t << 2), t=1431655765 & (t | t << 1), e | t << 1 } function tr(e) { var t=e, n=e; do { (t.x < n.x || t.x===n.x && t.y < n.y) && (n=t), t=t.next } while (t !==e); return n } function nr(e, t, n, r, i, a, o, s) { return (i - o) * (t - s) - (e - o) * (a - s)>= 0 && (e - o) * (r - s) - (n - o) * (t - s) >= 0 && (n - o) * (a - s) - (i - o) * (r - s) >= 0
}
function rr(e, t) {
return e.next.i !== t.i && e.prev.i !== t.i && !sr(e, t) && cr(e, t) && cr(t, e) && lr(e, t)
}
function ir(e, t, n) {
return (t.y - e.y) * (n.x - t.x) - (t.x - e.x) * (n.y - t.y)
}
function ar(e, t) {
return e.x === t.x && e.y === t.y
}
function or(e, t, n, r) {
return !!(ar(e, n) && ar(t, r) || ar(e, r) && ar(n, t)) || ir(e, t, n) > 0 != ir(e, t, r) > 0 && ir(n, r, e) > 0 != ir(n, r, t) > 0
}
function sr(e, t) {
var n = e;
do {
if (n.i !== e.i && n.next.i !== e.i && n.i !== t.i && n.next.i !== t.i && or(n, n.next, e, t)) return !0;
n = n.next
} while (n !== e);
return !1
}
function cr(e, t) {
return ir(e.prev, e, e.next) < 0 ? ir(e, t, e.next)>= 0 && ir(e, e.prev, t) >= 0 : ir(e, t, e.prev) < 0 || ir(e, e.next, t) < 0 } function lr(e, t) { var n=e, r=!1, i=(e.x + t.x) / 2, a=(e.y + t.y) / 2; do { n.y> a != n.next.y > a && n.next.y !== n.y && i < (n.next.x - n.x) * (a - n.y) / (n.next.y - n.y) + n.x && (r=!r), n=n.next } while (n !==e); return r } function hr(e, t) { var n=new dr(e.i, e.x, e.y), r=new dr(t.i, t.x, t.y), i=e.next, a=t.prev; return e.next=t, t.prev=e, n.next=i, i.prev=n, r.next=n, n.prev=r, a.next=r, r.prev=a, r } function ur(e, t, n, r) { var i=new dr(e, t, n); return r ? (i.next=r.next, i.prev=r, r.next.prev=i, r.next=i) : (i.prev=i, i.next=i), i } function pr(e) { e.next.prev=e.prev, e.prev.next=e.next, e.prevZ && (e.prevZ.nextZ=e.nextZ), e.nextZ && (e.nextZ.prevZ=e.prevZ) } function dr(e, t, n) { this.i=e, this.x=t, this.y=n, this.prev=null, this.next=null, this.z=null, this.prevZ=null, this.nextZ=null, this.steiner=!1 } function fr(e, t, n, r) { for (var i=0, a=t, o=n - r; a < n; a +=r) i +=(e[o] - e[a]) * (e[a + 1] + e[o + 1]), o=a; return i } function mr(e) { var t=e.length; t> 2 && e[t - 1].equals(e[0]) && e.pop()
}
function vr(e, t) {
for (var n = 0; n < t.length; n++) e.push(t[n].x), e.push(t[n].y) } function gr(e, t) { k.call(this), this.type="ExtrudeGeometry" , this.parameters={ shapes: e, options: t }, this.fromBufferGeometry(new yr(e, t)), this.mergeVertices() } function yr(e, t) { G.call(this), this.type="ExtrudeBufferGeometry" , this.parameters={ shapes: e, options: t }, e=Array.isArray(e) ? e : [e]; for (var r=this, a=[], o=[], s=0, c=e.length; s < c; s++) { var l=e[s]; ! function(e) { function s(e, t, n) { return t || console.error("THREE.ExtrudeGeometry: vec does not exist"), t.clone().multiplyScalar(n).add(e) } function c(e, t, r) { var i, a, o, s=e.x - t.x, c=e.y - t.y, l=r.x - e.x, h=r.y - e.y, u=s * s + c * c, p=s * h - c * l; if (Math.abs(p)> Number.EPSILON) {
var d = Math.sqrt(u),
f = Math.sqrt(l * l + h * h),
m = t.x - c / d,
v = t.y + s / d,
g = r.x - h / f,
y = r.y + l / f,
x = ((g - m) * h - (y - v) * l) / (s * h - c * l);
i = m + s * x - e.x, a = v + c * x - e.y;
var b = i * i + a * a;
if (b <= 2) return new n(i, a); o=Math.sqrt(b / 2) } else { var w=!1; s> Number.EPSILON ? l > Number.EPSILON && (w = !0) : s < -Number.EPSILON ? l < -Number.EPSILON && (w=!0) : Math.sign(c)===Math.sign(h) && (w=!0), w ? (i=-c, a=s, o=Math.sqrt(u)) : (i=s, a=c, o=Math.sqrt(u / 2)) } return new n(i / o, a / o) } function l(e, t) { var n, r; for (Z=e.length; --Z>= 0;) {
n = Z, (r = Z - 1) < 0 && (r=e.length - 1); var i=0, a=g + 2 * M; for (i=0; i < a; i++) { var o=q * i, s=q * (i + 1); p(t + n + o, t + r + o, t + r + s, t + n + s) } } } function h(e, t, n) { m.push(e), m.push(t), m.push(n) } function u(e, t, n) { d(e), d(t), d(n); var i=a.length / 3, o=T.generateTopUV(r, a, i - 3, i - 2, i - 1); f(o[0]), f(o[1]), f(o[2]) } function p(e, t, n, i) { d(e), d(t), d(i), d(t), d(n), d(i); var o=a.length / 3, s=T.generateSideWallUV(r, a, o - 6, o - 3, o - 2, o - 1); f(s[0]), f(s[1]), f(s[3]), f(s[1]), f(s[2]), f(s[3]) } function d(e) { a.push(m[3 * e + 0]), a.push(m[3 * e + 1]), a.push(m[3 * e + 2]) } function f(e) { o.push(e.x), o.push(e.y) } var m=[], v=void 0 !==t.curveSegments ? t.curveSegments : 12, g=void 0 !==t.steps ? t.steps : 1, y=void 0 !==t.depth ? t.depth : 100, x=void 0===t.bevelEnabled || t.bevelEnabled, b=void 0 !==t.bevelThickness ? t.bevelThickness : 6, w=void 0 !==t.bevelSize ? t.bevelSize : b - 2, _=void 0 !==t.bevelOffset ? t.bevelOffset : 0, M=void 0 !==t.bevelSegments ? t.bevelSegments : 3, S=t.extrudePath, T=void 0 !==t.UVGenerator ? t.UVGenerator : sp; void 0 !==t.amount && (console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."), y=t.amount); var E, A, L, R, P, C=!1; S && (E=S.getSpacedPoints(g), C=!0, x=!1, A=S.computeFrenetFrames(g, !1), L=new i, R=new i, P=new i), x || (M=0, b=0, w=0, _=0); var O, D, I, N=e.extractPoints(v), z=N.shape, B=N.holes; if (!op.isClockWise(z)) for (z=z.reverse(), D=0, I=B.length; D < I; D++) O=B[D], op.isClockWise(O) && (B[D]=O.reverse()); var U=op.triangulateShape(z, B), F=z; for (D=0, I=B.length; D < I; D++) O=B[D], z=z.concat(O); for (var G, H, V, j, k, W, q=z.length, X=U.length, Y=[], Z=0, J=F.length, Q=J - 1, K=Z + 1; Z < J; Z++, Q++, K++) Q===J && (Q=0), K===J && (K=0), Y[Z]=c(F[Z], F[Q], F[K]); var $, ee=[], te=Y.concat(); for (D=0, I=B.length; D < I; D++) { for (O=B[D], $=[], Z=0, J=O.length, Q=J - 1, K=Z + 1; Z < J; Z++, Q++, K++) Q===J && (Q=0), K===J && (K=0), $[Z]=c(O[Z], O[Q], O[K]); ee.push($), te=te.concat($) } for (G=0; G < M; G++) { for (V=G / M, j=b * Math.cos(V * Math.PI / 2), H=w * Math.sin(V * Math.PI / 2) + _, Z=0, J=F.length; Z < J; Z++) k=s(F[Z], Y[Z], H), h(k.x, k.y, -j); for (D=0, I=B.length; D < I; D++) for (O=B[D], $=ee[D], Z=0, J=O.length; Z < J; Z++) k=s(O[Z], $[Z], H), h(k.x, k.y, -j) } for (H=w + _, Z=0; Z < q; Z++) k=x ? s(z[Z], te[Z], H) : z[Z], C ? (R.copy(A.normals[0]).multiplyScalar(k.x), L.copy(A.binormals[0]).multiplyScalar(k.y), P.copy(E[0]).add(R).add(L), h(P.x, P.y, P.z)) : h(k.x, k.y, 0); var ne; for (ne=1; ne <=g; ne++) for (Z=0; Z < q; Z++) k=x ? s(z[Z], te[Z], H) : z[Z], C ? (R.copy(A.normals[ne]).multiplyScalar(k.x), L.copy(A.binormals[ne]).multiplyScalar(k.y), P.copy(E[ne]).add(R).add(L), h(P.x, P.y, P.z)) : h(k.x, k.y, y / g * ne); for (G=M - 1; G>= 0; G--) {
for (V = G / M, j = b * Math.cos(V * Math.PI / 2), H = w * Math.sin(V * Math.PI / 2) + _, Z = 0, J = F.length; Z < J; Z++) k=s(F[Z], Y[Z], H), h(k.x, k.y, y + j); for (D=0, I=B.length; D < I; D++) for (O=B[D], $=ee[D], Z=0, J=O.length; Z < J; Z++) k=s(O[Z], $[Z], H), C ? h(k.x, k.y + E[g - 1].y, E[g - 1].x + j) : h(k.x, k.y, y + j) }! function() { var e=a.length / 3; if (x) { var t=0, n=q * t; for (Z=0; Z < X; Z++) W=U[Z], u(W[2] + n, W[1] + n, W[0] + n); for (t=g + 2 * M, n=q * t, Z=0; Z < X; Z++) W=U[Z], u(W[0] + n, W[1] + n, W[2] + n) } else { for (Z=0; Z < X; Z++) W=U[Z], u(W[2], W[1], W[0]); for (Z=0; Z < X; Z++) W=U[Z], u(W[0] + q * g, W[1] + q * g, W[2] + q * g) } r.addGroup(e, a.length / 3 - e, 0) }(), function() { var e=a.length / 3, t=0; for (l(F, t), t +=F.length, D=0, I=B.length; D < I; D++) O=B[D], l(O, t), t +=O.length; r.addGroup(e, a.length / 3 - e, 1) }() }(l) } this.setAttribute("position", new z(a, 3)), this.setAttribute("uv", new z(o, 2)), this.computeVertexNormals() } function xr(e, t, n) { if (n.shapes=[], Array.isArray(e)) for (var r=0, i=e.length; r < i; r++) { var a=e[r]; n.shapes.push(a.uuid) } else n.shapes.push(e.uuid); return void 0 !==t.extrudePath && (n.options.extrudePath=t.extrudePath.toJSON()), n } function br(e, t) { k.call(this), this.type="TextGeometry" , this.parameters={ text: e, parameters: t }, this.fromBufferGeometry(new wr(e, t)), this.mergeVertices() } function wr(e, t) { t=t || {}; var n=t.font; if (!n || !n.isFont) return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."), new k; var r=n.generateShapes(e, t.size); t.depth=void 0 !==t.height ? t.height : 50, void 0===t.bevelThickness && (t.bevelThickness=10), void 0===t.bevelSize && (t.bevelSize=8), void 0===t.bevelEnabled && (t.bevelEnabled=!1), yr.call(this, r, t), this.type="TextBufferGeometry" } function _r(e, t, n, r, i, a, o) { k.call(this), this.type="SphereGeometry" , this.parameters={ radius: e, widthSegments: t, heightSegments: n, phiStart: r, phiLength: i, thetaStart: a, thetaLength: o }, this.fromBufferGeometry(new Mr(e, t, n, r, i, a, o)), this.mergeVertices() } function Mr(e, t, n, r, a, o, s) { G.call(this), this.type="SphereBufferGeometry" , this.parameters={ radius: e, widthSegments: t, heightSegments: n, phiStart: r, phiLength: a, thetaStart: o, thetaLength: s }, e=e || 1, t=Math.max(3, Math.floor(t) || 8), n=Math.max(2, Math.floor(n) || 6), r=void 0 !==r ? r : 0, a=void 0 !==a ? a : 2 * Math.PI, o=void 0 !==o ? o : 0, s=void 0 !==s ? s : Math.PI; var c, l, h=Math.min(o + s, Math.PI), u=0, p=[], d=new i, f=new i, m=[], v=[], g=[], y=[]; for (l=0; l <=n; l++) { var x=[], b=l / n, w=0; for (0==l && 0==o ? w=.5 / t : l==n && h==Math.PI && (w=-.5 / t), c=0; c <=t; c++) { var _=c / t; d.x=-e * Math.cos(r + _ * a) * Math.sin(o + b * s), d.y=e * Math.cos(o + b * s), d.z=e * Math.sin(r + _ * a) * Math.sin(o + b * s), v.push(d.x, d.y, d.z), f.copy(d).normalize(), g.push(f.x, f.y, f.z), y.push(_ + w, 1 - b), x.push(u++) } p.push(x) } for (l=0; l < n; l++) for (c=0; c < t; c++) { var M=p[l][c + 1], S=p[l][c], T=p[l + 1][c], E=p[l + 1][c + 1]; (0 !==l || o> 0) && m.push(M, S, E), (l !== n - 1 || h < Math.PI) && m.push(S, T, E) } this.setIndex(m), this.setAttribute("position", new z(v, 3)), this.setAttribute("normal", new z(g, 3)), this.setAttribute("uv", new z(y, 2)) } function Sr(e, t, n, r, i, a) { k.call(this), this.type="RingGeometry" , this.parameters={ innerRadius: e, outerRadius: t, thetaSegments: n, phiSegments: r, thetaStart: i, thetaLength: a }, this.fromBufferGeometry(new Tr(e, t, n, r, i, a)), this.mergeVertices() } function Tr(e, t, r, a, o, s) { G.call(this), this.type="RingBufferGeometry" , this.parameters={ innerRadius: e, outerRadius: t, thetaSegments: r, phiSegments: a, thetaStart: o, thetaLength: s }, e=e || .5, t=t || 1, o=void 0 !==o ? o : 0, s=void 0 !==s ? s : 2 * Math.PI, r=void 0 !==r ? Math.max(3, r) : 8, a=void 0 !==a ? Math.max(1, a) : 1; var c, l, h, u=[], p=[], d=[], f=[], m=e, v=(t - e) / a, g=new i, y=new n; for (l=0; l <=a; l++) { for (h=0; h <=r; h++) c=o + h / r * s, g.x=m * Math.cos(c), g.y=m * Math.sin(c), p.push(g.x, g.y, g.z), d.push(0, 0, 1), y.x=(g.x / t + 1) / 2, y.y=(g.y / t + 1) / 2, f.push(y.x, y.y); m +=v } for (l=0; l < a; l++) { var x=l * (r + 1); for (h=0; h < r; h++) { c=h + x; var b=c, w=c + r + 1, _=c + r + 2, M=c + 1; u.push(b, w, M), u.push(w, _, M) } } this.setIndex(u), this.setAttribute("position", new z(p, 3)), this.setAttribute("normal", new z(d, 3)), this.setAttribute("uv", new z(f, 2)) } function Er(e, t, n, r) { k.call(this), this.type="LatheGeometry" , this.parameters={ points: e, segments: t, phiStart: n, phiLength: r }, this.fromBufferGeometry(new Ar(e, t, n, r)), this.mergeVertices() } function Ar(e, t, r, a) { G.call(this), this.type="LatheBufferGeometry" , this.parameters={ points: e, segments: t, phiStart: r, phiLength: a }, t=Math.floor(t) || 12, r=r || 0, a=a || 2 * Math.PI, a=ll.clamp(a, 0, 2 * Math.PI); var o, s, c, l=[], h=[], u=[], p=1 / t, d=new i, f=new n; for (s=0; s <=t; s++) { var m=r + s * p * a, v=Math.sin(m), g=Math.cos(m); for (c=0; c <=e.length - 1; c++) d.x=e[c].x * v, d.y=e[c].y, d.z=e[c].x * g, h.push(d.x, d.y, d.z), f.x=s / t, f.y=c / (e.length - 1), u.push(f.x, f.y) } for (s=0; s < t; s++) for (c=0; c < e.length - 1; c++) { o=c + s * e.length; var y=o, x=o + e.length, b=o + e.length + 1, w=o + 1; l.push(y, x, w), l.push(x, b, w) } if (this.setIndex(l), this.setAttribute("position", new z(h, 3)), this.setAttribute("uv", new z(u, 2)), this.computeVertexNormals(), a===2 * Math.PI) { var _=this.attributes.normal.array, M=new i, S=new i, T=new i; for (o=t * e.length * 3, s=0, c=0; s < e.length; s++, c +=3) M.x=_[c + 0], M.y=_[c + 1], M.z=_[c + 2], S.x=_[o + c + 0], S.y=_[o + c + 1], S.z=_[o + c + 2], T.addVectors(M, S).normalize(), _[c + 0]=_[o + c + 0]=T.x, _[c + 1]=_[o + c + 1]=T.y, _[c + 2]=_[o + c + 2]=T.z } } function Lr(e, t) { k.call(this), this.type="ShapeGeometry" , "object"==typeof t && (console.warn("THREE.ShapeGeometry: Options parameter has been removed."), t=t.curveSegments), this.parameters={ shapes: e, curveSegments: t }, this.fromBufferGeometry(new Rr(e, t)), this.mergeVertices() } function Rr(e, t) { function n(e) { var n, s, l, h=i.length / 3, u=e.extractPoints(t), p=u.shape, d=u.holes; for (!1===op.isClockWise(p) && (p=p.reverse()), n=0, s=d.length; n < s; n++) l=d[n], !0===op.isClockWise(l) && (d[n]=l.reverse()); var f=op.triangulateShape(p, d); for (n=0, s=d.length; n < s; n++) l=d[n], p=p.concat(l); for (n=0, s=p.length; n < s; n++) { var m=p[n]; i.push(m.x, m.y, 0), a.push(0, 0, 1), o.push(m.x, m.y) } for (n=0, s=f.length; n < s; n++) { var v=f[n], g=v[0] + h, y=v[1] + h, x=v[2] + h; r.push(g, y, x), c +=3 } } G.call(this), this.type="ShapeBufferGeometry" , this.parameters={ shapes: e, curveSegments: t }, t=t || 12; var r=[], i=[], a=[], o=[], s=0, c=0; if (!1===Array.isArray(e)) n(e); else for (var l=0; l < e.length; l++) n(e[l]), this.addGroup(s, c, l), s +=c, c=0; this.setIndex(r), this.setAttribute("position", new z(i, 3)), this.setAttribute("normal", new z(a, 3)), this.setAttribute("uv", new z(o, 2)) } function Pr(e, t) { if (t.shapes=[], Array.isArray(e)) for (var n=0, r=e.length; n < r; n++) { var i=e[n]; t.shapes.push(i.uuid) } else t.shapes.push(e.uuid); return t } function Cr(e, t) { G.call(this), this.type="EdgesGeometry" , this.parameters={ thresholdAngle: t }, t=void 0 !==t ? t : 1; var n, r, i, a, o=[], s=Math.cos(ll.DEG2RAD * t), c=[0, 0], l={}, h=["a", "b" , "c" ]; e.isBufferGeometry ? (a=new k, a.fromBufferGeometry(e)) : a=e.clone(), a.mergeVertices(), a.computeFaceNormals(); for (var u=a.vertices, p=a.faces, d=0, f=p.length; d < f; d++) for (var m=p[d], v=0; v < 3; v++) n=m[h[v]], r=m[h[(v + 1) % 3]], c[0]=Math.min(n, r), c[1]=Math.max(n, r), i=c[0] + "," + c[1], void 0===l[i] ? l[i]={ index1: c[0], index2: c[1], face1: d, face2: void 0 } : l[i].face2=d; for (i in l) { var g=l[i]; if (void 0===g.face2 || p[g.face1].normal.dot(p[g.face2].normal) <=s) { var y=u[g.index1]; o.push(y.x, y.y, y.z), y=u[g.index2], o.push(y.x, y.y, y.z) } } this.setAttribute("position", new z(o, 3)) } function Or(e, t, n, r, i, a, o, s) { k.call(this), this.type="CylinderGeometry" , this.parameters={ radiusTop: e, radiusBottom: t, height: n, radialSegments: r, heightSegments: i, openEnded: a, thetaStart: o, thetaLength: s }, this.fromBufferGeometry(new Dr(e, t, n, r, i, a, o, s)), this.mergeVertices() } function Dr(e, t, r, a, o, s, c, l) { function h(r) { var o, s, h, g=new n, b=new i, w=0, _=!0===r ? e : t, M=!0===r ? 1 : -1; for (s=v, o=1; o <=a; o++) d.push(0, y * M, 0), f.push(0, M, 0), m.push(.5, .5), v++; for (h=v, o=0; o <=a; o++) { var S=o / a, T=S * l + c, E=Math.cos(T), A=Math.sin(T); b.x=_ * A, b.y=y * M, b.z=_ * E, d.push(b.x, b.y, b.z), f.push(0, M, 0), g.x=.5 * E + .5, g.y=.5 * A * M + .5, m.push(g.x, g.y), v++ } for (o=0; o < a; o++) { var L=s + o, R=h + o; !0===r ? p.push(R, R + 1, L) : p.push(R + 1, R, L), w +=3 } u.addGroup(x, w, !0===r ? 1 : 2), x +=w } G.call(this), this.type="CylinderBufferGeometry" , this.parameters={ radiusTop: e, radiusBottom: t, height: r, radialSegments: a, heightSegments: o, openEnded: s, thetaStart: c, thetaLength: l }; var u=this; e=void 0 !==e ? e : 1, t=void 0 !==t ? t : 1, r=r || 1, a=Math.floor(a) || 8, o=Math.floor(o) || 1, s=void 0 !==s && s, c=void 0 !==c ? c : 0, l=void 0 !==l ? l : 2 * Math.PI; var p=[], d=[], f=[], m=[], v=0, g=[], y=r / 2, x=0; ! function() { var n, s, h=new i, b=new i, w=0, _=(t - e) / r; for (s=0; s <=o; s++) { var M=[], S=s / o, T=S * (t - e) + e; for (n=0; n <=a; n++) { var E=n / a, A=E * l + c, L=Math.sin(A), R=Math.cos(A); b.x=T * L, b.y=-S * r + y, b.z=T * R, d.push(b.x, b.y, b.z), h.set(L, _, R).normalize(), f.push(h.x, h.y, h.z), m.push(E, 1 - S), M.push(v++) } g.push(M) } for (n=0; n < a; n++) for (s=0; s < o; s++) { var P=g[s][n], C=g[s + 1][n], O=g[s + 1][n + 1], D=g[s][n + 1]; p.push(P, C, D), p.push(C, O, D), w +=6 } u.addGroup(x, w, 0), x +=w }(), !1===s && (e> 0 && h(!0), t > 0 && h(!1)), this.setIndex(p), this.setAttribute("position", new z(d, 3)), this.setAttribute("normal", new z(f, 3)), this.setAttribute("uv", new z(m, 2))
}
function Ir(e, t, n, r, i, a, o) {
Or.call(this, 0, e, t, n, r, i, a, o), this.type = "ConeGeometry", this.parameters = {
radius: e,
height: t,
radialSegments: n,
heightSegments: r,
openEnded: i,
thetaStart: a,
thetaLength: o
}
}
function Nr(e, t, n, r, i, a, o) {
Dr.call(this, 0, e, t, n, r, i, a, o), this.type = "ConeBufferGeometry", this.parameters = {
radius: e,
height: t,
radialSegments: n,
heightSegments: r,
openEnded: i,
thetaStart: a,
thetaLength: o
}
}
function zr(e, t, n, r) {
k.call(this), this.type = "CircleGeometry", this.parameters = {
radius: e,
segments: t,
thetaStart: n,
thetaLength: r
}, this.fromBufferGeometry(new Br(e, t, n, r)), this.mergeVertices()
}
function Br(e, t, r, a) {
G.call(this), this.type = "CircleBufferGeometry", this.parameters = {
radius: e,
segments: t,
thetaStart: r,
thetaLength: a
}, e = e || 1, t = void 0 !== t ? Math.max(3, t) : 8, r = void 0 !== r ? r : 0, a = void 0 !== a ? a : 2 * Math.PI;
var o, s, c = [],
l = [],
h = [],
u = [],
p = new i,
d = new n;
for (l.push(0, 0, 0), h.push(0, 0, 1), u.push(.5, .5), s = 0, o = 3; s <= t; s++, o +=3) { var f=r + s / t * a; p.x=e * Math.cos(f), p.y=e * Math.sin(f), l.push(p.x, p.y, p.z), h.push(0, 0, 1), d.x=(l[o] / e + 1) / 2, d.y=(l[o + 1] / e + 1) / 2, u.push(d.x, d.y) } for (o=1; o <=t; o++) c.push(o, o + 1, 0); this.setIndex(c), this.setAttribute("position", new z(l, 3)), this.setAttribute("normal", new z(h, 3)), this.setAttribute("uv", new z(u, 2)) } function Ur(e) { E.call(this), this.type="ShadowMaterial" , this.color=new w(0), this.transparent=!0, this.setValues(e) } function Fr(e) { X.call(this, e), this.type="RawShaderMaterial" } function Gr(e) { E.call(this), this.defines={ STANDARD: "" }, this.type="MeshStandardMaterial" , this.color=new w(16777215), this.roughness=.5, this.metalness=.5, this.map=null, this.lightMap=null, this.lightMapIntensity=1, this.aoMap=null, this.aoMapIntensity=1, this.emissive=new w(0), this.emissiveIntensity=1, this.emissiveMap=null, this.bumpMap=null, this.bumpScale=1, this.normalMap=null, this.normalMapType=nl, this.normalScale=new n(1, 1), this.displacementMap=null, this.displacementScale=1, this.displacementBias=0, this.roughnessMap=null, this.metalnessMap=null, this.alphaMap=null, this.envMap=null, this.envMapIntensity=1, this.refractionRatio=.98, this.wireframe=!1, this.wireframeLinewidth=1, this.wireframeLinecap="round" , this.wireframeLinejoin="round" , this.skinning=!1, this.morphTargets=!1, this.morphNormals=!1, this.setValues(e) } function Hr(e) { Gr.call(this), this.defines={ STANDARD: "" , PHYSICAL: "" }, this.type="MeshPhysicalMaterial" , this.reflectivity=.5, this.clearcoat=0, this.clearcoatRoughness=0, this.sheen=null, this.clearcoatNormalScale=new n(1, 1), this.clearcoatNormalMap=null, this.transparency=0, this.setValues(e) } function Vr(e) { E.call(this), this.type="MeshPhongMaterial" , this.color=new w(16777215), this.specular=new w(1118481), this.shininess=30, this.map=null, this.lightMap=null, this.lightMapIntensity=1, this.aoMap=null, this.aoMapIntensity=1, this.emissive=new w(0), this.emissiveIntensity=1, this.emissiveMap=null, this.bumpMap=null, this.bumpScale=1, this.normalMap=null, this.normalMapType=nl, this.normalScale=new n(1, 1), this.displacementMap=null, this.displacementScale=1, this.displacementBias=0, this.specularMap=null, this.alphaMap=null, this.envMap=null, this.combine=Rs, this.reflectivity=1, this.refractionRatio=.98, this.wireframe=!1, this.wireframeLinewidth=1, this.wireframeLinecap="round" , this.wireframeLinejoin="round" , this.skinning=!1, this.morphTargets=!1, this.morphNormals=!1, this.setValues(e) } function jr(e) { E.call(this), this.defines={ TOON: "" }, this.type="MeshToonMaterial" , this.color=new w(16777215), this.specular=new w(1118481), this.shininess=30, this.map=null, this.gradientMap=null, this.lightMap=null, this.lightMapIntensity=1, this.aoMap=null, this.aoMapIntensity=1, this.emissive=new w(0), this.emissiveIntensity=1, this.emissiveMap=null, this.bumpMap=null, this.bumpScale=1, this.normalMap=null, this.normalMapType=nl, this.normalScale=new n(1, 1), this.displacementMap=null, this.displacementScale=1, this.displacementBias=0, this.specularMap=null, this.alphaMap=null, this.wireframe=!1, this.wireframeLinewidth=1, this.wireframeLinecap="round" , this.wireframeLinejoin="round" , this.skinning=!1, this.morphTargets=!1, this.morphNormals=!1, this.setValues(e) } function kr(e) { E.call(this), this.type="MeshNormalMaterial" , this.bumpMap=null, this.bumpScale=1, this.normalMap=null, this.normalMapType=nl, this.normalScale=new n(1, 1), this.displacementMap=null, this.displacementScale=1, this.displacementBias=0, this.wireframe=!1, this.wireframeLinewidth=1, this.fog=!1, this.skinning=!1, this.morphTargets=!1, this.morphNormals=!1, this.setValues(e) } function Wr(e) { E.call(this), this.type="MeshLambertMaterial" , this.color=new w(16777215), this.map=null, this.lightMap=null, this.lightMapIntensity=1, this.aoMap=null, this.aoMapIntensity=1, this.emissive=new w(0), this.emissiveIntensity=1, this.emissiveMap=null, this.specularMap=null, this.alphaMap=null, this.envMap=null, this.combine=Rs, this.reflectivity=1, this.refractionRatio=.98, this.wireframe=!1, this.wireframeLinewidth=1, this.wireframeLinecap="round" , this.wireframeLinejoin="round" , this.skinning=!1, this.morphTargets=!1, this.morphNormals=!1, this.setValues(e) } function qr(e) { E.call(this), this.defines={ MATCAP: "" }, this.type="MeshMatcapMaterial" , this.color=new w(16777215), this.matcap=null, this.map=null, this.bumpMap=null, this.bumpScale=1, this.normalMap=null, this.normalMapType=nl, this.normalScale=new n(1, 1), this.displacementMap=null, this.displacementScale=1, this.displacementBias=0, this.alphaMap=null, this.skinning=!1, this.morphTargets=!1, this.morphNormals=!1, this.setValues(e) } function Xr(e) { un.call(this), this.type="LineDashedMaterial" , this.scale=1, this.dashSize=3, this.gapSize=1, this.setValues(e) } function Yr(e, t, n, r) { this.parameterPositions=e, this._cachedIndex=0, this.resultBuffer=void 0 !==r ? r : new t.constructor(n), this.sampleValues=t, this.valueSize=n } function Zr(e, t, n, r) { Yr.call(this, e, t, n, r), this._weightPrev=-0, this._offsetPrev=-0, this._weightNext=-0, this._offsetNext=-0 } function Jr(e, t, n, r) { Yr.call(this, e, t, n, r) } function Qr(e, t, n, r) { Yr.call(this, e, t, n, r) } function Kr(e, t, n, r) { if (void 0===e) throw new Error("THREE.KeyframeTrack: track name is undefined"); if (void 0===t || 0===t.length) throw new Error("THREE.KeyframeTrack: no keyframes in track named " + e);
this.name = e, this.times = hp.convertArray(t, this.TimeBufferType), this.values = hp.convertArray(n, this.ValueBufferType), this.setInterpolation(r || this.DefaultInterpolation)
}
function $r(e, t, n) {
Kr.call(this, e, t, n)
}
function ei(e, t, n, r) {
Kr.call(this, e, t, n, r)
}
function ti(e, t, n, r) {
Kr.call(this, e, t, n, r)
}
function ni(e, t, n, r) {
Yr.call(this, e, t, n, r)
}
function ri(e, t, n, r) {
Kr.call(this, e, t, n, r)
}
function ii(e, t, n, r) {
Kr.call(this, e, t, n, r)
}
function ai(e, t, n, r) {
Kr.call(this, e, t, n, r)
}
function oi(e, t, n) {
this.name = e, this.tracks = n, this.duration = void 0 !== t ? t : -1,
this.uuid = ll.generateUUID(), this.duration < 0 && this.resetDuration()
}
function si(e) {
switch (e.toLowerCase()) {
case " scalar": case "double" : case "float" : case "number" : case "integer" : return ti; case "vector" : case "vector2" : case "vector3" : case "vector4" : return ai; case "color" : return ei; case "quaternion" : return ri; case "bool" : case "boolean" : return $r; case "string" : return ii } throw new Error("THREE.KeyframeTrack: Unsupported typeName: " + e)
}
function ci(e) {
if (void 0 === e.type) throw new Error(" THREE.KeyframeTrack: track type undefined, can not parse"); var t=si(e.type); if (void 0===e.times) { var n=[], r=[]; hp.flattenJSON(e.keys, n, r, "value" ), e.times=n, e.values=r } return void 0 !==t.parse ? t.parse(e) : new t(e.name, e.times, e.values, e.interpolation) } function li(e, t, n) { var r=this, i=!1, a=0, o=0, s=void 0, c=[]; this.onStart=void 0, this.onLoad=e, this.onProgress=t, this.onError=n, this.itemStart=function(e) { o++, !1===i && void 0 !==r.onStart && r.onStart(e, a, o), i=!0 }, this.itemEnd=function(e) { a++, void 0 !==r.onProgress && r.onProgress(e, a, o), a===o && (i=!1, void 0 !==r.onLoad && r.onLoad()) }, this.itemError=function(e) { void 0 !==r.onError && r.onError(e) }, this.resolveURL=function(e) { return s ? s(e) : e }, this.setURLModifier=function(e) { return s=e, this }, this.addHandler=function(e, t) { return c.push(e, t), this }, this.removeHandler=function(e) { var t=c.indexOf(e); return -1 !==t && c.splice(t, 2), this }, this.getHandler=function(e) { for (var t=0, n=c.length; t < n; t +=2) { var r=c[t], i=c[t + 1]; if (r.global && (r.lastIndex=0), r.test(e)) return i } return null } } function hi(e) { this.manager=void 0 !==e ? e : pp, this.crossOrigin="anonymous" , this.path="" , this.resourcePath="" } function ui(e) { hi.call(this, e) } function pi(e) { hi.call(this, e) } function di(e) { hi.call(this, e) } function fi(e) { hi.call(this, e) } function mi(e) { hi.call(this, e) } function vi(e) { hi.call(this, e) } function gi(e) { hi.call(this, e) } function yi() { this.type="Curve" , this.arcLengthDivisions=200 } function xi(e, t, n, r, i, a, o, s) { yi.call(this), this.type="EllipseCurve" , this.aX=e || 0, this.aY=t || 0, this.xRadius=n || 1, this.yRadius=r || 1, this.aStartAngle=i || 0, this.aEndAngle=a || 2 * Math.PI, this.aClockwise=o || !1, this.aRotation=s || 0 } function bi(e, t, n, r, i, a) { xi.call(this, e, t, n, n, r, i, a), this.type="ArcCurve" } function wi() { function e(e, a, o, s) { t=e, n=o, r=-3 * e + 3 * a - 2 * o - s, i=2 * e - 2 * a + o + s } var t=0, n=0, r=0, i=0; return { initCatmullRom: function(t, n, r, i, a) { e(n, r, a * (r - t), a * (i - n)) }, initNonuniformCatmullRom: function(t, n, r, i, a, o, s) { var c=(n - t) / a - (r - t) / (a + o) + (r - n) / o, l=(r - n) / o - (i - n) / (o + s) + (i - r) / s; c *=o, l *=o, e(n, r, c, l) }, calc: function(e) { var a=e * e; return t + n * e + r * a + i * (a * e) } } } function _i(e, t, n, r) { yi.call(this), this.type="CatmullRomCurve3" , this.points=e || [], this.closed=t || !1, this.curveType=n || "centripetal" , this.tension=r || .5 } function Mi(e, t, n, r, i) { var a=.5 * (r - t), o=.5 * (i - n), s=e * e; return (2 * n - 2 * r + a + o) * (e * s) + (-3 * n + 3 * r - 2 * a - o) * s + a * e + n } function Si(e, t) { var n=1 - e; return n * n * t } function Ti(e, t) { return 2 * (1 - e) * e * t } function Ei(e, t) { return e * e * t } function Ai(e, t, n, r) { return Si(e, t) + Ti(e, n) + Ei(e, r) } function Li(e, t) { var n=1 - e; return n * n * n * t } function Ri(e, t) { var n=1 - e; return 3 * n * n * e * t } function Pi(e, t) { return 3 * (1 - e) * e * e * t } function Ci(e, t) { return e * e * e * t } function Oi(e, t, n, r, i) { return Li(e, t) + Ri(e, n) + Pi(e, r) + Ci(e, i) } function Di(e, t, r, i) { yi.call(this), this.type="CubicBezierCurve" , this.v0=e || new n, this.v1=t || new n, this.v2=r || new n, this.v3=i || new n } function Ii(e, t, n, r) { yi.call(this), this.type="CubicBezierCurve3" , this.v0=e || new i, this.v1=t || new i, this.v2=n || new i, this.v3=r || new i } function Ni(e, t) { yi.call(this), this.type="LineCurve" , this.v1=e || new n, this.v2=t || new n } function zi(e, t) { yi.call(this), this.type="LineCurve3" , this.v1=e || new i, this.v2=t || new i } function Bi(e, t, r) { yi.call(this), this.type="QuadraticBezierCurve" , this.v0=e || new n, this.v1=t || new n, this.v2=r || new n } function Ui(e, t, n) { yi.call(this), this.type="QuadraticBezierCurve3" , this.v0=e || new i, this.v1=t || new i, this.v2=n || new i } function Fi(e) { yi.call(this), this.type="SplineCurve" , this.points=e || [] } function Gi() { yi.call(this), this.type="CurvePath" , this.curves=[], this.autoClose=!1 } function Hi(e) { Gi.call(this), this.type="Path" , this.currentPoint=new n, e && this.setFromPoints(e) } function Vi(e) { Hi.call(this, e), this.uuid=ll.generateUUID(), this.type="Shape" , this.holes=[] } function ji(e, t) { d.call(this), this.type="Light" , this.color=new w(e), this.intensity=void 0 !==t ? t : 1, this.receiveShadow=void 0 } function ki(e, t, n) { ji.call(this, e, n), this.type="HemisphereLight" , this.castShadow=void 0, this.position.copy(d.DefaultUp), this.updateMatrix(), this.groundColor=new w(t) } function Wi(e) { this.camera=e, this.bias=0, this.radius=1, this.mapSize=new n(512, 512), this.map=null, this.mapPass=null, this.matrix=new h, this._frustum=new $, this._frameExtents=new n(1, 1), this._viewportCount=1, this._viewports=[new s(0, 0, 1, 1)] } function qi() { Wi.call(this, new Z(50, 1, .5, 500)) } function Xi(e, t, n, r, i, a) { ji.call(this, e, t), this.type="SpotLight" , this.position.copy(d.DefaultUp), this.updateMatrix(), this.target=new d, Object.defineProperty(this, "power" , { get: function() { return this.intensity * Math.PI }, set: function(e) { this.intensity=e / Math.PI } }), this.distance=void 0 !==n ? n : 0, this.angle=void 0 !==r ? r : Math.PI / 3, this.penumbra=void 0 !==i ? i : 0, this.decay=void 0 !==a ? a : 1, this.shadow=new qi } function Yi() { Wi.call(this, new Z(90, 1, .5, 500)), this._frameExtents=new n(4, 2), this._viewportCount=6, this._viewports=[new s(2, 1, 1, 1), new s(0, 1, 1, 1), new s(3, 1, 1, 1), new s(1, 1, 1, 1), new s(3, 0, 1, 1), new s(1, 0, 1, 1)], this._cubeDirections=[new i(1, 0, 0), new i(-1, 0, 0), new i(0, 0, 1), new i(0, 0, -1), new i(0, 1, 0), new i(0, -1, 0)], this._cubeUps=[new i(0, 1, 0), new i(0, 1, 0), new i(0, 1, 0), new i(0, 1, 0), new i(0, 0, 1), new i(0, 0, -1)] } function Zi(e, t, n, r) { ji.call(this, e, t), this.type="PointLight" , Object.defineProperty(this, "power" , { get: function() { return 4 * this.intensity * Math.PI }, set: function(e) { this.intensity=e / (4 * Math.PI) } }), this.distance=void 0 !==n ? n : 0, this.decay=void 0 !==r ? r : 1, this.shadow=new Yi } function Ji(e, t, n, r, i, a) { Y.call(this), this.type="OrthographicCamera" , this.zoom=1, this.view=null, this.left=void 0 !==e ? e : -1, this.right=void 0 !==t ? t : 1, this.top=void 0 !==n ? n : 1, this.bottom=void 0 !==r ? r : -1, this.near=void 0 !==i ? i : .1, this.far=void 0 !==a ? a : 2e3, this.updateProjectionMatrix() } function Qi() { Wi.call(this, new Ji(-5, 5, 5, -5, .5, 500)) } function Ki(e, t) { ji.call(this, e, t), this.type="DirectionalLight" , this.position.copy(d.DefaultUp), this.updateMatrix(), this.target=new d, this.shadow=new Qi } function $i(e, t) { ji.call(this, e, t), this.type="AmbientLight" , this.castShadow=void 0 } function ea(e, t, n, r) { ji.call(this, e, t), this.type="RectAreaLight" , this.width=void 0 !==n ? n : 10, this.height=void 0 !==r ? r : 10 } function ta(e) { hi.call(this, e), this.textures={} } function na() { G.call(this), this.type="InstancedBufferGeometry" , this.maxInstancedCount=void 0 } function ra(e, t, n, r) { "number"==typeof n && (r=n, n=!1, console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")), L.call(this, e, t, n), this.meshPerAttribute=r || 1 } function ia(e) { hi.call(this, e) } function aa(e) { hi.call(this, e) } function oa(e) { "undefined"==typeof createImageBitmap && console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."), "undefined"==typeof fetch && console.warn("THREE.ImageBitmapLoader: fetch() not supported."), hi.call(this, e), this.options=void 0 } function sa() { this.type="ShapePath" , this.color=new w, this.subPaths=[], this.currentPath=null } function ca(e) { this.type="Font" , this.data=e } function la(e, t, n) { for (var r=Array.from ? Array.from(e) : String(e).split(""), i=t / n.resolution, a=(n.boundingBox.yMax - n.boundingBox.yMin + n.underlineThickness) * i, o=[], s=0, c=0, l=0; l < r.length; l++) { var h=r[l]; if ("\n"===h) s=0, c -=a; else { var u=ha(h, i, s, c, n); s +=u.offsetX, o.push(u.path) } } return o } function ha(e, t, n, r, i) { var a=i.glyphs[e] || i.glyphs["?"]; if (!a) return void console.error('THREE.Font: character "' + e + '" does not exists in font family ' + i.familyName + ".");
var o, s, c, l, h, u, p, d, f = new sa;
if (a.o)
for (var m = a._cachedOutline || (a._cachedOutline = a.o.split(" ")), v = 0, g = m.length; v < g;) {
var y = m[v++];
switch (y) {
case "m":
o = m[v++] * t + n, s = m[v++] * t + r, f.moveTo(o, s);
break;
case "l":
o = m[v++] * t + n, s = m[v++] * t + r, f.lineTo(o, s);
break;
case "q":
c = m[v++] * t + n, l = m[v++] * t + r, h = m[v++] * t + n, u = m[v++] * t + r, f.quadraticCurveTo(h, u, c, l);
break;
case "b":
c = m[v++] * t + n, l = m[v++] * t + r, h = m[v++] * t + n, u = m[v++] * t + r, p = m[v++] * t + n, d = m[v++] * t + r, f.bezierCurveTo(h, u, p, d, c, l)
}
}
return {
offsetX: a.ha * t,
path: f
}
}
function ua(e) {
hi.call(this, e)
}
function pa(e) {
hi.call(this, e)
}
function da() {
this.coefficients = [];
for (var e = 0; e < 9; e++) this.coefficients.push(new i)
}
function fa(e, t) {
ji.call(this, void 0, t), this.sh = void 0 !== e ? e : new da
}
function ma(e, t, n) {
fa.call(this, void 0, n);
var r = (new w).set(e),
a = (new w).set(t),
o = new i(r.r, r.g, r.b),
s = new i(a.r, a.g, a.b),
c = Math.sqrt(Math.PI),
l = c * Math.sqrt(.75);
this.sh.coefficients[0].copy(o).add(s).multiplyScalar(c), this.sh.coefficients[1].copy(o).sub(s).multiplyScalar(l)
}
function va(e, t) {
fa.call(this, void 0, t);
var n = (new w).set(e);
this.sh.coefficients[0].set(n.r, n.g, n.b).multiplyScalar(2 * Math.sqrt(Math.PI))
}
function ga() {
this.type = "StereoCamera", this.aspect = 1, this.eyeSep = .064, this.cameraL = new Z, this.cameraL.layers.enable(1), this.cameraL.matrixAutoUpdate = !1, this.cameraR = new Z, this.cameraR.layers.enable(2), this.cameraR.matrixAutoUpdate = !1, this._cache = {
focus: null,
fov: null,
aspect: null,
near: null,
far: null,
zoom: null,
eyeSep: null
}
}
function ya(e) {
this.autoStart = void 0 === e || e, this.startTime = 0, this.oldTime = 0, this.elapsedTime = 0, this.running = !1
}
function xa() {
d.call(this), this.type = "AudioListener", this.context = Tp.getContext(), this.gain = this.context.createGain(), this.gain.connect(this.context.destination), this.filter = null, this.timeDelta = 0, this._clock = new ya
}
function ba(e) {
d.call(this), this.type = "Audio", this.listener = e, this.context = e.context, this.gain = this.context.createGain(), this.gain.connect(e.getInput()), this.autoplay = !1, this.buffer = null, this.detune = 0, this.loop = !1, this.loopStart = 0, this.loopEnd = 0, this.offset = 0, this.duration = void 0, this.playbackRate = 1, this.isPlaying = !1, this.hasPlaybackControl = !0, this.sourceType = "empty", this._startedAt = 0, this._pausedAt = 0, this.filters = []
}
function wa(e) {
ba.call(this, e), this.panner = this.context.createPanner(), this.panner.panningModel = "HRTF", this.panner.connect(this.gain)
}
function _a(e, t) {
this.analyser = e.context.createAnalyser(), this.analyser.fftSize = void 0 !== t ? t : 2048, this.data = new Uint8Array(this.analyser.frequencyBinCount), e.getOutput().connect(this.analyser)
}
function Ma(e, t, n) {
this.binding = e, this.valueSize = n;
var r, i = Float64Array;
switch (t) {
case "quaternion":
r = this._slerp;
break;
case "string":
case "bool":
i = Array, r = this._select;
break;
default:
r = this._lerp
}
this.buffer = new i(4 * n), this._mixBufferRegion = r, this.cumulativeWeight = 0, this.useCount = 0, this.referenceCount = 0
}
function Sa(e, t, n) {
var r = n || Ta.parseTrackName(t);
this._targetGroup = e, this._bindings = e.subscribe_(t, r)
}
function Ta(e, t, n) {
this.path = t, this.parsedPath = n || Ta.parseTrackName(t), this.node = Ta.findNode(e, this.parsedPath.nodeName) || e, this.rootNode = e
}
function Ea() {
this.uuid = ll.generateUUID(), this._objects = Array.prototype.slice.call(arguments), this.nCachedObjects_ = 0;
var e = {};
this._indicesByUUID = e;
for (var t = 0, n = arguments.length; t !== n; ++t) e[arguments[t].uuid] = t;
this._paths = [], this._parsedPaths = [], this._bindings = [], this._bindingsIndicesByPath = {};
var r = this;
this.stats = {
objects: {
get total() {
return r._objects.length
},
get inUse() {
return this.total - r.nCachedObjects_
}
},
get bindingsPerObject() {
return r._bindings.length
}
}
}
function Aa(e, t, n) {
this._mixer = e, this._clip = t, this._localRoot = n || null;
for (var r = t.tracks, i = r.length, a = new Array(i), o = {
endingStart: Wc,
endingEnd: Wc
}, s = 0; s !== i; ++s) {
var c = r[s].createInterpolant(null);
a[s] = c, c.settings = o
}
this._interpolantSettings = o, this._interpolants = a, this._propertyBindings = new Array(i), this._cacheIndex = null, this._byClipCacheIndex = null, this._timeScaleInterpolant = null, this._weightInterpolant = null, this.loop = kc, this._loopCount = -1, this._startTime = null, this.time = 0, this.timeScale = 1, this._effectiveTimeScale = 1, this.weight = 1, this._effectiveWeight = 1, this.repetitions = 1 / 0, this.paused = !1, this.enabled = !0, this.clampWhenFinished = !1, this.zeroSlopeAtStart = !0, this.zeroSlopeAtEnd = !0
}
function La(e) {
this._root = e, this._initMemoryManager(), this._accuIndex = 0, this.time = 0, this.timeScale = 1
}
function Ra(e) {
"string" == typeof e && (console.warn("THREE.Uniform: Type parameter is no longer needed."), e = arguments[1]), this.value = e
}
function Pa(e, t, n) {
en.call(this, e, t), this.meshPerAttribute = n || 1
}
function Ca(e, t, n, r) {
this.ray = new y(e, t), this.near = n || 0, this.far = r || 1 / 0, this.camera = null, this.params = {
Mesh: {},
Line: {},
LOD: {},
Points: {
threshold: 1
},
Sprite: {}
}, Object.defineProperties(this.params, {
PointCloud: {
get: function() {
return console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points."), this.Points
}
}
})
}
function Oa(e, t) {
return e.distance - t.distance
}
function Da(e, t, n, r) {
if (!1 !== e.visible && (e.raycast(t, n), !0 === r))
for (var i = e.children, a = 0, o = i.length; a < o; a++) Da(i[a], t, n, !0)
}
function Ia(e, t, n) {
return this.radius = void 0 !== e ? e : 1, this.phi = void 0 !== t ? t : 0, this.theta = void 0 !== n ? n : 0, this
}
function Na(e, t, n) {
return this.radius = void 0 !== e ? e : 1, this.theta = void 0 !== t ? t : 0, this.y = void 0 !== n ? n : 0, this
}
function za(e, t) {
this.min = void 0 !== e ? e : new n(1 / 0, 1 / 0), this.max = void 0 !== t ? t : new n(-1 / 0, -1 / 0)
}
function Ba(e, t) {
this.start = void 0 !== e ? e : new i, this.end = void 0 !== t ? t : new i
}
function Ua(e) {
d.call(this), this.material = e, this.render = function() {}
}
function Fa(e, t, n, r) {
this.object = e, this.size = void 0 !== t ? t : 1;
var i = void 0 !== n ? n : 16711680,
a = void 0 !== r ? r : 1,
o = 0,
s = this.object.geometry;
s && s.isGeometry ? o = 3 * s.faces.length : s && s.isBufferGeometry && (o = s.attributes.normal.count);
var c = new G,
l = new z(2 * o * 3, 3);
c.setAttribute("position", l), dn.call(this, c, new un({
color: i,
linewidth: a
})), this.matrixAutoUpdate = !1, this.update()
}
function Ga(e, t, n, r) {
this.object = e, this.size = void 0 !== t ? t : 1;
var i = void 0 !== n ? n : 65535,
a = void 0 !== r ? r : 1,
o = this.object.geometry;
if (!o || !o.isBufferGeometry) return void console.error("THREE.VertexTangentsHelper: geometry not an instance of THREE.BufferGeometry.", o);
var s = o.attributes.tangent.count,
c = new G,
l = new z(2 * s * 3, 3);
c.setAttribute("position", l), dn.call(this, c, new un({
color: i,
linewidth: a
})), this.matrixAutoUpdate = !1, this.update()
}
function Ha(e, t) {
d.call(this), this.light = e, this.light.updateMatrixWorld(), this.matrix = e.matrixWorld, this.matrixAutoUpdate = !1, this.color = t;
for (var n = new G, r = [0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, -1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, -1, 1], i = 0, a = 1; i < 32; i++, a++) {
var o = i / 32 * Math.PI * 2,
s = a / 32 * Math.PI * 2;
r.push(Math.cos(o), Math.sin(o), 1, Math.cos(s), Math.sin(s), 1)
}
n.setAttribute("position", new z(r, 3));
var c = new un({
fog: !1
});
this.cone = new dn(n, c), this.add(this.cone), this.update()
}
function Va(e) {
var t = [];
e && e.isBone && t.push(e);
for (var n = 0; n < e.children.length; n++) t.push.apply(t, Va(e.children[n]));
return t
}
function ja(e) {
for (var t = Va(e), n = new G, r = [], i = [], a = new w(0, 0, 1), o = new w(0, 1, 0), s = 0; s < t.length; s++) {
var c = t[s];
c.parent && c.parent.isBone && (r.push(0, 0, 0), r.push(0, 0, 0), i.push(a.r, a.g, a.b), i.push(o.r, o.g, o.b))
}
n.setAttribute("position", new z(r, 3)), n.setAttribute("color", new z(i, 3));
var l = new un({
vertexColors: Ko,
depthTest: !1,
depthWrite: !1,
transparent: !0
});
dn.call(this, n, l), this.root = e, this.bones = t, this.matrix = e.matrixWorld, this.matrixAutoUpdate = !1
}
function ka(e, t, n) {
this.light = e, this.light.updateMatrixWorld(), this.color = n;
var r = new Mr(t, 4, 2),
i = new A({
wireframe: !0,
fog: !1
});
H.call(this, r, i), this.matrix = this.light.matrixWorld, this.matrixAutoUpdate = !1, this.update()
}
function Wa(e, t) {
this.type = "RectAreaLightHelper", this.light = e, this.color = t;
var n = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, -1, 0, 1, 1, 0],
r = new G;
r.setAttribute("position", new z(n, 3)), r.computeBoundingSphere();
var i = new un({
fog: !1
});
pn.call(this, r, i);
var a = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, 1, 0, -1, -1, 0, 1, -1, 0],
o = new G;
o.setAttribute("position", new z(a, 3)), o.computeBoundingSphere(), this.add(new H(o, new A({
side: Yo,
fog: !1
}))), this.update()
}
function qa(e, t, n) {
d.call(this), this.light = e, this.light.updateMatrixWorld(), this.matrix = e.matrixWorld, this.matrixAutoUpdate = !1, this.color = n;
var r = new Pn(t);
r.rotateY(.5 * Math.PI), this.material = new A({
wireframe: !0,
fog: !1
}), void 0 === this.color && (this.material.vertexColors = Ko);
var i = r.getAttribute("position"),
a = new Float32Array(3 * i.count);
r.setAttribute("color", new L(a, 3)), this.add(new H(r, this.material)), this.update()
}
function Xa(e, t) {
this.lightProbe = e, this.size = t;
var n = {};
n.GAMMA_OUTPUT = "";
var r = new X({
defines: n,
uniforms: {
sh: {
value: this.lightProbe.sh.coefficients
},
intensity: {
value: this.lightProbe.intensity
}
},
vertexShader: ["varying vec3 vNormal;", "void main() {", "\tvNormal = normalize( normalMatrix * normal );", "\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", "}"].join("\n"),
fragmentShader: ["#define RECIPROCAL_PI 0.318309886", "vec3 inverseTransformDirection( in vec3 normal, in mat4 matrix ) {", "\t// matrix is assumed to be orthogonal", "\treturn normalize( ( vec4( normal, 0.0 ) * matrix ).xyz );", "}", "vec3 linearToOutput( in vec3 a ) {", "\t#ifdef GAMMA_OUTPUT", "\t\treturn pow( a, vec3( 1.0 / float( GAMMA_FACTOR ) ) );", "\t#else", "\t\treturn a;", "\t#endif", "}", "// source: https://graphics.stanford.edu/papers/envmap/envmap.pdf", "vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {", "\t// normal is assumed to have unit length", "\tfloat x = normal.x, y = normal.y, z = normal.z;", "\t// band 0", "\tvec3 result = shCoefficients[ 0 ] * 0.886227;", "\t// band 1", "\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;", "\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;", "\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;", "\t// band 2", "\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;", "\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;", "\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );", "\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;", "\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );", "\treturn result;", "}", "uniform vec3 sh[ 9 ]; // sh coefficients", "uniform float intensity; // light probe intensity", "varying vec3 vNormal;", "void main() {", "\tvec3 normal = normalize( vNormal );", "\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );", "\tvec3 irradiance = shGetIrradianceAt( worldNormal, sh );", "\tvec3 outgoingLight = RECIPROCAL_PI * irradiance * intensity;", "\toutgoingLight = linearToOutput( outgoingLight );", "\tgl_FragColor = vec4( outgoingLight, 1.0 );", "}"].join("\n")
}),
i = new Mr(1, 32, 16);
H.call(this, i, r), this.onBeforeRender()
}
function Ya(e, t, n, r) {
e = e || 10, t = t || 10, n = new w(void 0 !== n ? n : 4473924), r = new w(void 0 !== r ? r : 8947848);
for (var i = t / 2, a = e / t, o = e / 2, s = [], c = [], l = 0, h = 0, u = -o; l <= t; l++, u += a) {
s.push(-o, 0, u, o, 0, u), s.push(u, 0, -o, u, 0, o);
var p = l === i ? n : r;
p.toArray(c, h), h += 3, p.toArray(c, h), h += 3, p.toArray(c, h), h += 3, p.toArray(c, h), h += 3
}
var d = new G;
d.setAttribute("position", new z(s, 3)), d.setAttribute("color", new z(c, 3));
var f = new un({
vertexColors: Ko
});
dn.call(this, d, f)
}
function Za(e, t, n, r, i, a) {
e = e || 10, t = t || 16, n = n || 8, r = r || 64, i = new w(void 0 !== i ? i : 4473924), a = new w(void 0 !== a ? a : 8947848);
var o, s, c, l, h, u, p, d = [],
f = [];
for (l = 0; l <= t; l++) c = l / t * (2 * Math.PI), o = Math.sin(c) * e, s = Math.cos(c) * e, d.push(0, 0, 0), d.push(o, 0, s), p = 1 & l ? i : a, f.push(p.r, p.g, p.b), f.push(p.r, p.g, p.b);
for (l = 0; l <= n; l++)
for (p = 1 & l ? i : a, u = e - e / n * l, h = 0; h < r; h++) c = h / r * (2 * Math.PI), o = Math.sin(c) * u, s = Math.cos(c) * u, d.push(o, 0, s), f.push(p.r, p.g, p.b), c = (h + 1) / r * (2 * Math.PI), o = Math.sin(c) * u, s = Math.cos(c) * u, d.push(o, 0, s), f.push(p.r, p.g, p.b);
var m = new G;
m.setAttribute("position", new z(d, 3)), m.setAttribute("color", new z(f, 3));
var v = new un({
vertexColors: Ko
});
dn.call(this, m, v)
}
function Ja(e, t, n, r) {
this.audio = e, this.range = t || 1, this.divisionsInnerAngle = n || 16, this.divisionsOuterAngle = r || 2;
var i = new G,
a = this.divisionsInnerAngle + 2 * this.divisionsOuterAngle,
o = new Float32Array(3 * (3 * a + 3));
i.setAttribute("position", new L(o, 3));
var s = new un({
color: 65280
}),
c = new un({
color: 16776960
});
pn.call(this, i, [c, s]), this.update()
}
function Qa(e, t, n, r) {
this.object = e, this.size = void 0 !== t ? t : 1;
var i = void 0 !== n ? n : 16776960,
a = void 0 !== r ? r : 1,
o = 0,
s = this.object.geometry;
s && s.isGeometry ? o = s.faces.length : console.warn("THREE.FaceNormalsHelper: only THREE.Geometry is supported. Use THREE.VertexNormalsHelper, instead.");
var c = new G,
l = new z(2 * o * 3, 3);
c.setAttribute("position", l), dn.call(this, c, new un({
color: i,
linewidth: a
})), this.matrixAutoUpdate = !1, this.update()
}
function Ka(e, t, n) {
d.call(this), this.light = e, this.light.updateMatrixWorld(), this.matrix = e.matrixWorld, this.matrixAutoUpdate = !1, this.color = n, void 0 === t && (t = 1);
var r = new G;
r.setAttribute("position", new z([-t, t, 0, t, t, 0, t, -t, 0, -t, -t, 0, -t, t, 0], 3));
var i = new un({
fog: !1
});
this.lightPlane = new pn(r, i), this.add(this.lightPlane), r = new G, r.setAttribute("position", new z([0, 0, 0, 0, 0, 1], 3)), this.targetLine = new pn(r, i), this.add(this.targetLine), this.update()
}
function $a(e) {
function t(e, t, r) {
n(e, r), n(t, r)
}
function n(e, t) {
a.push(0, 0, 0), o.push(t.r, t.g, t.b), void 0 === s[e] && (s[e] = []), s[e].push(a.length / 3 - 1)
}
var r = new G,
i = new un({
color: 16777215,
vertexColors: Qo
}),
a = [],
o = [],
s = {},
c = new w(16755200),
l = new w(16711680),
h = new w(43775),
u = new w(16777215),
p = new w(3355443);
t("n1", "n2", c), t("n2", "n4", c), t("n4", "n3", c), t("n3", "n1", c), t("f1", "f2", c), t("f2", "f4", c), t("f4", "f3", c), t("f3", "f1", c), t("n1", "f1", c), t("n2", "f2", c), t("n3", "f3", c), t("n4", "f4", c), t("p", "n1", l), t("p", "n2", l), t("p", "n3", l), t("p", "n4", l), t("u1", "u2", h), t("u2", "u3", h), t("u3", "u1", h), t("c", "t", u), t("p", "c", p), t("cn1", "cn2", p), t("cn3", "cn4", p), t("cf1", "cf2", p), t("cf3", "cf4", p), r.setAttribute("position", new z(a, 3)), r.setAttribute("color", new z(o, 3)), dn.call(this, r, i), this.camera = e, this.camera.updateProjectionMatrix && this.camera.updateProjectionMatrix(), this.matrix = e.matrixWorld, this.matrixAutoUpdate = !1, this.pointMap = s, this.update()
}
function eo(e, t, n, r, i, a, o) {
fd.set(i, a, o).unproject(r);
var s = t[e];
if (void 0 !== s)
for (var c = n.getAttribute("position"), l = 0, h = s.length; l < h; l++) c.setXYZ(s[l], fd.x, fd.y, fd.z)
}
function to(e, t) {
this.object = e, void 0 === t && (t = 16776960);
var n = new Uint16Array([0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7]),
r = new Float32Array(24),
i = new G;
i.setIndex(new L(n, 1)), i.setAttribute("position", new L(r, 3)), dn.call(this, i, new un({
color: t
})), this.matrixAutoUpdate = !1, this.update()
}
function no(e, t) {
this.type = "Box3Helper", this.box = e, t = t || 16776960;
var n = new Uint16Array([0, 1, 1, 2, 2, 3, 3, 0, 4, 5, 5, 6, 6, 7, 7, 4, 0, 4, 1, 5, 2, 6, 3, 7]),
r = [1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, -1, -1, -1, -1, 1, -1, -1],
i = new G;
i.setIndex(new L(n, 1)), i.setAttribute("position", new z(r, 3)), dn.call(this, i, new un({
color: t
})), this.geometry.computeBoundingSphere()
}
function ro(e, t, n) {
this.type = "PlaneHelper", this.plane = e, this.size = void 0 === t ? 1 : t;
var r = void 0 !== n ? n : 16776960,
i = [1, -1, 1, -1, 1, 1, -1, -1, 1, 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0],
a = new G;
a.setAttribute("position", new z(i, 3)), a.computeBoundingSphere(), pn.call(this, a, new un({
color: r
}));
var o = [1, 1, 1, -1, 1, 1, -1, -1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1],
s = new G;
s.setAttribute("position", new z(o, 3)), s.computeBoundingSphere(), this.add(new H(s, new A({
color: r,
opacity: .2,
transparent: !0,
depthWrite: !1
})))
}
function io(e, t, n, r, a, o) {
d.call(this), void 0 === e && (e = new i(0, 0, 1)), void 0 === t && (t = new i(0, 0, 0)), void 0 === n && (n = 1), void 0 === r && (r = 16776960), void 0 === a && (a = .2 * n), void 0 === o && (o = .2 * a), void 0 === gd && (gd = new G, gd.setAttribute("position", new z([0, 0, 0, 0, 1, 0], 3)), yd = new Dr(0, .5, 1, 5, 1), yd.translate(0, -.5, 0)), this.position.copy(t), this.line = new pn(gd, new un({
color: r
})), this.line.matrixAutoUpdate = !1, this.add(this.line), this.cone = new H(yd, new A({
color: r
})), this.cone.matrixAutoUpdate = !1, this.add(this.cone), this.setDirection(e), this.setLength(n, a, o)
}
function ao(e) {
e = e || 1;
var t = [0, 0, 0, e, 0, 0, 0, 0, 0, 0, e, 0, 0, 0, 0, 0, 0, e],
n = [1, 0, 0, 1, .6, 0, 0, 1, 0, .6, 1, 0, 0, 0, 1, 0, .6, 1],
r = new G;
r.setAttribute("position", new z(t, 3)), r.setAttribute("color", new z(n, 3));
var i = new un({
vertexColors: Ko
});
dn.call(this, r, i)
}
function oo(e, t, n, r, i, a, o) {
return console.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead."), new T(e, t, n, i, a, o)
}
function so(e) {
return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."), e
}
function co(e) {
return void 0 === e && (e = []), console.warn("THREE.MultiMaterial has been removed. Use an Array instead."), e.isMultiMaterial = !0, e.materials = e, e.clone = function() {
return e.slice()
}, e
}
function lo(e, t) {
return console.warn("THREE.PointCloud has been renamed to THREE.Points."), new vn(e, t)
}
function ho(e) {
return console.warn("THREE.Particle has been renamed to THREE.Sprite."), new rn(e)
}
function uo(e, t) {
return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."), new vn(e, t)
}
function po(e) {
return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."), new mn(e)
}
function fo(e) {
return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."), new mn(e)
}
function mo(e) {
return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."), new mn(e)
}
function vo(e, t, n) {
return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."), new i(e, t, n)
}
function go(e, t) {
return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setDynamic( true ) instead."), new L(e, t).setDynamic(!0)
}
function yo(e, t) {
return console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."), new R(e, t)
}
function xo(e, t) {
return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."), new P(e, t)
}
function bo(e, t) {
return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."), new C(e, t)
}
function wo(e, t) {
return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."), new O(e, t)
}
function _o(e, t) {
return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."), new D(e, t)
}
function Mo(e, t) {
return console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."), new I(e, t)
}
function So(e, t) {
return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."), new N(e, t)
}
function To(e, t) {
return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."), new z(e, t)
}
function Eo(e, t) {
return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."), new B(e, t)
}
function Ao(e) {
console.warn("THREE.ClosedSplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."), _i.call(this, e), this.type = "catmullrom", this.closed = !0
}
function Lo(e) {
console.warn("THREE.SplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."), _i.call(this, e), this.type = "catmullrom"
}
function Ro(e) {
console.warn("THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead."), _i.call(this, e), this.type = "catmullrom"
}
function Po(e) {
return console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper."), new ao(e)
}
function Co(e, t) {
return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."), new to(e, t)
}
function Oo(e, t) {
return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."), new dn(new Cr(e.geometry), new un({
color: void 0 !== t ? t : 16777215
}))
}
function Do(e, t) {
return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."), new dn(new _n(e.geometry), new un({
color: void 0 !== t ? t : 16777215
}))
}
function Io(e) {
return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."), new ui(e)
}
function No(e) {
return console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."), new fi(e)
}
function zo() {
console.error("THREE.CanvasRenderer has been removed")
}
function Bo() {
console.error("THREE.JSONLoader has been removed.")
}
function Uo() {
console.error("THREE.LensFlare has been moved to /examples/js/objects/Lensflare.js")
}
void 0 === Number.EPSILON && (Number.EPSILON = Math.pow(2, -52)), void 0 === Number.isInteger && (Number.isInteger = function(e) {
return "number" == typeof e && isFinite(e) && Math.floor(e) === e
}), void 0 === Math.sign && (Math.sign = function(e) {
return e < 0 ? -1 : e > 0 ? 1 : +e
}), "name" in Function.prototype == !1 && Object.defineProperty(Function.prototype, "name", {
get: function() {
return this.toString().match(/^\s*function\s*([^\(\s]*)/)[1]
}
}), void 0 === Object.assign && (Object.assign = function(e) {
if (void 0 === e || null === e) throw new TypeError("Cannot convert undefined or null to object");
for (var t = Object(e), n = 1; n < arguments.length; n++) {
var r = arguments[n];
if (void 0 !== r && null !== r)
for (var i in r) Object.prototype.hasOwnProperty.call(r, i) && (t[i] = r[i])
}
return t
});
var Fo = {
LEFT: 0,
MIDDLE: 1,
RIGHT: 2,
ROTATE: 0,
DOLLY: 1,
PAN: 2
},
Go = {
ROTATE: 0,
PAN: 1,
DOLLY_PAN: 2,
DOLLY_ROTATE: 3
},
Ho = 0,
Vo = 1,
jo = 2,
ko = 1,
Wo = 2,
qo = 3,
Xo = 0,
Yo = 1,
Zo = 2,
Jo = 0,
Qo = 1,
Ko = 2,
$o = 0,
es = 1,
ts = 2,
ns = 3,
rs = 4,
is = 5,
as = 100,
os = 101,
ss = 102,
cs = 103,
ls = 104,
hs = 200,
us = 201,
ps = 202,
ds = 203,
fs = 204,
ms = 205,
vs = 206,
gs = 207,
ys = 208,
xs = 209,
bs = 210,
ws = 0,
_s = 1,
Ms = 2,
Ss = 3,
Ts = 4,
Es = 5,
As = 6,
Ls = 7,
Rs = 0,
Ps = 1,
Cs = 2,
Os = 0,
Ds = 1,
Is = 2,
Ns = 3,
zs = 4,
Bs = 5,
Us = 301,
Fs = 302,
Gs = 303,
Hs = 304,
Vs = 305,
js = 306,
ks = 307,
Ws = 1e3,
qs = 1001,
Xs = 1002,
Ys = 1003,
Zs = 1004,
Js = 1005,
Qs = 1006,
Ks = 1007,
$s = 1008,
ec = 1009,
tc = 1010,
nc = 1011,
rc = 1012,
ic = 1013,
ac = 1014,
oc = 1015,
sc = 1016,
cc = 1017,
lc = 1018,
hc = 1019,
uc = 1020,
pc = 1021,
dc = 1022,
fc = 1023,
mc = 1024,
vc = 1025,
gc = fc,
yc = 1026,
xc = 1027,
bc = 1028,
wc = 33776,
_c = 33777,
Mc = 33778,
Sc = 33779,
Tc = 35840,
Ec = 35841,
Ac = 35842,
Lc = 35843,
Rc = 36196,
Pc = 37808,
Cc = 37809,
Oc = 37810,
Dc = 37811,
Ic = 37812,
Nc = 37813,
zc = 37814,
Bc = 37815,
Uc = 37816,
Fc = 37817,
Gc = 37818,
Hc = 37819,
Vc = 37820,
jc = 37821,
kc = 2201,
Wc = 2400,
qc = 3e3,
Xc = 3001,
Yc = 3007,
Zc = 3002,
Jc = 3003,
Qc = 3004,
Kc = 3005,
$c = 3006,
el = 3200,
tl = 3201,
nl = 0,
rl = 1,
il = 7680,
al = 519,
ol = 35044;
Object.assign(t.prototype, {
addEventListener: function(e, t) {
void 0 === this._listeners && (this._listeners = {});
var n = this._listeners;
void 0 === n[e] && (n[e] = []), -1 === n[e].indexOf(t) && n[e].push(t)
},
hasEventListener: function(e, t) {
if (void 0 === this._listeners) return !1;
var n = this._listeners;
return void 0 !== n[e] && -1 !== n[e].indexOf(t)
},
removeEventListener: function(e, t) {
if (void 0 !== this._listeners) {
var n = this._listeners,
r = n[e];
if (void 0 !== r) {
var i = r.indexOf(t); - 1 !== i && r.splice(i, 1)
}
}
},
dispatchEvent: function(e) {
if (void 0 !== this._listeners) {
var t = this._listeners,
n = t[e.type];
if (void 0 !== n) {
e.target = this;
for (var r = n.slice(0), i = 0, a = r.length; i < a; i++) r[i].call(this, e)
}
}
}
});
for (var sl = [], cl = 0; cl < 256; cl++) sl[cl] = (cl < 16 ? "0" : "") + cl.toString(16);
var ll = {
DEG2RAD: Math.PI / 180,
RAD2DEG: 180 / Math.PI,
generateUUID: function() {
var e = 4294967295 * Math.random() | 0,
t = 4294967295 * Math.random() | 0,
n = 4294967295 * Math.random() | 0,
r = 4294967295 * Math.random() | 0;
return (sl[255 & e] + sl[e >> 8 & 255] + sl[e >> 16 & 255] + sl[e >> 24 & 255] + "-" + sl[255 & t] + sl[t >> 8 & 255] + "-" + sl[t >> 16 & 15 | 64] + sl[t >> 24 & 255] + "-" + sl[63 & n | 128] + sl[n >> 8 & 255] + "-" + sl[n >> 16 & 255] + sl[n >> 24 & 255] + sl[255 & r] + sl[r >> 8 & 255] + sl[r >> 16 & 255] + sl[r >> 24 & 255]).toUpperCase()
},
clamp: function(e, t, n) {
return Math.max(t, Math.min(n, e))
},
euclideanModulo: function(e, t) {
return (e % t + t) % t
},
mapLinear: function(e, t, n, r, i) {
return r + (e - t) * (i - r) / (n - t)
},
lerp: function(e, t, n) {
return (1 - n) * e + n * t
},
smoothstep: function(e, t, n) {
return e <= t ? 0 : e >= n ? 1 : (e = (e - t) / (n - t)) * e * (3 - 2 * e)
},
smootherstep: function(e, t, n) {
return e <= t ? 0 : e >= n ? 1 : (e = (e - t) / (n - t)) * e * e * (e * (6 * e - 15) + 10)
},
randInt: function(e, t) {
return e + Math.floor(Math.random() * (t - e + 1))
},
randFloat: function(e, t) {
return e + Math.random() * (t - e)
},
randFloatSpread: function(e) {
return e * (.5 - Math.random())
},
degToRad: function(e) {
return e * ll.DEG2RAD
},
radToDeg: function(e) {
return e * ll.RAD2DEG
},
isPowerOfTwo: function(e) {
return 0 == (e & e - 1) && 0 !== e
},
ceilPowerOfTwo: function(e) {
return Math.pow(2, Math.ceil(Math.log(e) / Math.LN2))
},
floorPowerOfTwo: function(e) {
return Math.pow(2, Math.floor(Math.log(e) / Math.LN2))
}
};
Object.defineProperties(n.prototype, {
width: {
get: function() {
return this.x
},
set: function(e) {
this.x = e
}
},
height: {
get: function() {
return this.y
},
set: function(e) {
this.y = e
}
}
}), Object.assign(n.prototype, {
isVector2: !0,
set: function(e, t) {
return this.x = e, this.y = t, this
},
setScalar: function(e) {
return this.x = e, this.y = e, this
},
setX: function(e) {
return this.x = e, this
},
setY: function(e) {
return this.y = e, this
},
setComponent: function(e, t) {
switch (e) {
case 0:
this.x = t;
break;
case 1:
this.y = t;
break;
default:
throw new Error("index is out of range: " + e)
}
return this
},
getComponent: function(e) {
switch (e) {
case 0:
return this.x;
case 1:
return this.y;
default:
throw new Error("index is out of range: " + e)
}
},
clone: function() {
return new this.constructor(this.x, this.y)
},
copy: function(e) {
return this.x = e.x, this.y = e.y, this
},
add: function(e, t) {
return void 0 !== t ? (console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."), this.addVectors(e, t)) : (this.x += e.x, this.y += e.y, this)
},
addScalar: function(e) {
return this.x += e, this.y += e, this
},
addVectors: function(e, t) {
return this.x = e.x + t.x, this.y = e.y + t.y, this
},
addScaledVector: function(e, t) {
return this.x += e.x * t, this.y += e.y * t, this
},
sub: function(e, t) {
return void 0 !== t ? (console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."), this.subVectors(e, t)) : (this.x -= e.x, this.y -= e.y, this)
},
subScalar: function(e) {
return this.x -= e, this.y -= e, this
},
subVectors: function(e, t) {
return this.x = e.x - t.x, this.y = e.y - t.y, this
},
multiply: function(e) {
return this.x *= e.x, this.y *= e.y, this
},
multiplyScalar: function(e) {
return this.x *= e, this.y *= e, this
},
divide: function(e) {
return this.x /= e.x, this.y /= e.y, this
},
divideScalar: function(e) {
return this.multiplyScalar(1 / e)
},
applyMatrix3: function(e) {
var t = this.x,
n = this.y,
r = e.elements;
return this.x = r[0] * t + r[3] * n + r[6], this.y = r[1] * t + r[4] * n + r[7], this
},
min: function(e) {
return this.x = Math.min(this.x, e.x), this.y = Math.min(this.y, e.y), this
},
max: function(e) {
return this.x = Math.max(this.x, e.x), this.y = Math.max(this.y, e.y), this
},
clamp: function(e, t) {
return this.x = Math.max(e.x, Math.min(t.x, this.x)), this.y = Math.max(e.y, Math.min(t.y, this.y)), this
},
clampScalar: function(e, t) {
return this.x = Math.max(e, Math.min(t, this.x)), this.y = Math.max(e, Math.min(t, this.y)), this
},
clampLength: function(e, t) {
var n = this.length();
return this.divideScalar(n || 1).multiplyScalar(Math.max(e, Math.min(t, n)))
},
floor: function() {
return this.x = Math.floor(this.x), this.y = Math.floor(this.y), this
},
ceil: function() {
return this.x = Math.ceil(this.x), this.y = Math.ceil(this.y), this
},
round: function() {
return this.x = Math.round(this.x), this.y = Math.round(this.y), this
},
roundToZero: function() {
return this.x = this.x < 0 ? Math.ceil(this.x) : Math.floor(this.x), this.y = this.y < 0 ? Math.ceil(this.y) : Math.floor(this.y), this
},
negate: function() {
return this.x = -this.x, this.y = -this.y, this
},
dot: function(e) {
return this.x * e.x + this.y * e.y
},
cross: function(e) {
return this.x * e.y - this.y * e.x
},
lengthSq: function() {
return this.x * this.x + this.y * this.y
},
length: function() {
return Math.sqrt(this.x * this.x + this.y * this.y)
},
manhattanLength: function() {
return Math.abs(this.x) + Math.abs(this.y)
},
normalize: function() {
return this.divideScalar(this.length() || 1)
},
angle: function() {
var e = Math.atan2(this.y, this.x);
return e < 0 && (e += 2 * Math.PI), e
},
distanceTo: function(e) {
return Math.sqrt(this.distanceToSquared(e))
},
distanceToSquared: function(e) {
var t = this.x - e.x,
n = this.y - e.y;
return t * t + n * n
},
manhattanDistanceTo: function(e) {
return Math.abs(this.x - e.x) + Math.abs(this.y - e.y)
},
setLength: function(e) {
return this.normalize().multiplyScalar(e)
},
lerp: function(e, t) {
return this.x += (e.x - this.x) * t, this.y += (e.y - this.y) * t, this
},
lerpVectors: function(e, t, n) {
return this.subVectors(t, e).multiplyScalar(n).add(e)
},
equals: function(e) {
return e.x === this.x && e.y === this.y
},
fromArray: function(e, t) {
return void 0 === t && (t = 0), this.x = e[t], this.y = e[t + 1], this
},
toArray: function(e, t) {
return void 0 === e && (e = []), void 0 === t && (t = 0), e[t] = this.x, e[t + 1] = this.y, e
},
fromBufferAttribute: function(e, t, n) {
return void 0 !== n && console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."), this.x = e.getX(t), this.y = e.getY(t), this
},
rotateAround: function(e, t) {
var n = Math.cos(t),
r = Math.sin(t),
i = this.x - e.x,
a = this.y - e.y;
return this.x = i * n - a * r + e.x, this.y = i * r + a * n + e.y, this
}
}), Object.assign(r, {
slerp: function(e, t, n, r) {
return n.copy(e).slerp(t, r)
},
slerpFlat: function(e, t, n, r, i, a, o) {
var s = n[r + 0],
c = n[r + 1],
l = n[r + 2],
h = n[r + 3],
u = i[a + 0],
p = i[a + 1],
d = i[a + 2],
f = i[a + 3];
if (h !== f || s !== u || c !== p || l !== d) {
var m = 1 - o,
v = s * u + c * p + l * d + h * f,
g = v >= 0 ? 1 : -1,
y = 1 - v * v;
if (y > Number.EPSILON) {
var x = Math.sqrt(y),
b = Math.atan2(x, v * g);
m = Math.sin(m * b) / x, o = Math.sin(o * b) / x
}
var w = o * g;
if (s = s * m + u * w, c = c * m + p * w, l = l * m + d * w, h = h * m + f * w, m === 1 - o) {
var _ = 1 / Math.sqrt(s * s + c * c + l * l + h * h);
s *= _, c *= _, l *= _, h *= _
}
}
e[t] = s, e[t + 1] = c, e[t + 2] = l, e[t + 3] = h
}
}), Object.defineProperties(r.prototype, {
x: {
get: function() {
return this._x
},
set: function(e) {
this._x = e, this._onChangeCallback()
}
},
y: {
get: function() {
return this._y
},
set: function(e) {
this._y = e, this._onChangeCallback()
}
},
z: {
get: function() {
return this._z
},
set: function(e) {
this._z = e, this._onChangeCallback()
}
},
w: {
get: function() {
return this._w
},
set: function(e) {
this._w = e, this._onChangeCallback()
}
}
}), Object.assign(r.prototype, {
isQuaternion: !0,
set: function(e, t, n, r) {
return this._x = e, this._y = t, this._z = n, this._w = r, this._onChangeCallback(), this
},
clone: function() {
return new this.constructor(this._x, this._y, this._z, this._w)
},
copy: function(e) {
return this._x = e.x, this._y = e.y, this._z = e.z, this._w = e.w, this._onChangeCallback(), this
},
setFromEuler: function(e, t) {
if (!e || !e.isEuler) throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");
var n = e._x,
r = e._y,
i = e._z,
a = e.order,
o = Math.cos,
s = Math.sin,
c = o(n / 2),
l = o(r / 2),
h = o(i / 2),
u = s(n / 2),
p = s(r / 2),
d = s(i / 2);
return "XYZ" === a ? (this._x = u * l * h + c * p * d, this._y = c * p * h - u * l * d, this._z = c * l * d + u * p * h, this._w = c * l * h - u * p * d) : "YXZ" === a ? (this._x = u * l * h + c * p * d, this._y = c * p * h - u * l * d, this._z = c * l * d - u * p * h, this._w = c * l * h + u * p * d) : "ZXY" === a ? (this._x = u * l * h - c * p * d, this._y = c * p * h + u * l * d, this._z = c * l * d + u * p * h, this._w = c * l * h - u * p * d) : "ZYX" === a ? (this._x = u * l * h - c * p * d, this._y = c * p * h + u * l * d, this._z = c * l * d - u * p * h, this._w = c * l * h + u * p * d) : "YZX" === a ? (this._x = u * l * h + c * p * d, this._y = c * p * h + u * l * d, this._z = c * l * d - u * p * h, this._w = c * l * h - u * p * d) : "XZY" === a && (this._x = u * l * h - c * p * d, this._y = c * p * h - u * l * d, this._z = c * l * d + u * p * h, this._w = c * l * h + u * p * d), !1 !== t && this._onChangeCallback(), this
},
setFromAxisAngle: function(e, t) {
var n = t / 2,
r = Math.sin(n);
return this._x = e.x * r, this._y = e.y * r, this._z = e.z * r, this._w = Math.cos(n), this._onChangeCallback(), this
},
setFromRotationMatrix: function(e) {
var t, n = e.elements,
r = n[0],
i = n[4],
a = n[8],
o = n[1],
s = n[5],
c = n[9],
l = n[2],
h = n[6],
u = n[10],
p = r + s + u;
return p > 0 ? (t = .5 / Math.sqrt(p + 1), this._w = .25 / t, this._x = (h - c) * t, this._y = (a - l) * t, this._z = (o - i) * t) : r > s && r > u ? (t = 2 * Math.sqrt(1 + r - s - u), this._w = (h - c) / t, this._x = .25 * t, this._y = (i + o) / t, this._z = (a + l) / t) : s > u ? (t = 2 * Math.sqrt(1 + s - r - u), this._w = (a - l) / t, this._x = (i + o) / t, this._y = .25 * t, this._z = (c + h) / t) : (t = 2 * Math.sqrt(1 + u - r - s), this._w = (o - i) / t, this._x = (a + l) / t, this._y = (c + h) / t, this._z = .25 * t), this._onChangeCallback(), this
},
setFromUnitVectors: function(e, t) {
var n = e.dot(t) + 1;
return n < 1e-6 ? (n = 0, Math.abs(e.x) > Math.abs(e.z) ? (this._x = -e.y, this._y = e.x, this._z = 0, this._w = n) : (this._x = 0, this._y = -e.z, this._z = e.y, this._w = n)) : (this._x = e.y * t.z - e.z * t.y, this._y = e.z * t.x - e.x * t.z, this._z = e.x * t.y - e.y * t.x, this._w = n), this.normalize()
},
angleTo: function(e) {
return 2 * Math.acos(Math.abs(ll.clamp(this.dot(e), -1, 1)))
},
rotateTowards: function(e, t) {
var n = this.angleTo(e);
if (0 === n) return this;
var r = Math.min(1, t / n);
return this.slerp(e, r), this
},
inverse: function() {
return this.conjugate()
},
conjugate: function() {
return this._x *= -1, this._y *= -1, this._z *= -1, this._onChangeCallback(), this
},
dot: function(e) {
return this._x * e._x + this._y * e._y + this._z * e._z + this._w * e._w
},
lengthSq: function() {
return this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w
},
length: function() {
return Math.sqrt(this._x * this._x + this._y * this._y + this._z * this._z + this._w * this._w)
},
normalize: function() {
var e = this.length();
return 0 === e ? (this._x = 0, this._y = 0, this._z = 0, this._w = 1) : (e = 1 / e, this._x = this._x * e, this._y = this._y * e, this._z = this._z * e, this._w = this._w * e), this._onChangeCallback(), this
},
multiply: function(e, t) {
return void 0 !== t ? (console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."), this.multiplyQuaternions(e, t)) : this.multiplyQuaternions(this, e)
},
premultiply: function(e) {
return this.multiplyQuaternions(e, this)
},
multiplyQuaternions: function(e, t) {
var n = e._x,
r = e._y,
i = e._z,
a = e._w,
o = t._x,
s = t._y,
c = t._z,
l = t._w;
return this._x = n * l + a * o + r * c - i * s, this._y = r * l + a * s + i * o - n * c, this._z = i * l + a * c + n * s - r * o, this._w = a * l - n * o - r * s - i * c, this._onChangeCallback(), this
},
slerp: function(e, t) {
if (0 === t) return this;
if (1 === t) return this.copy(e);
var n = this._x,
r = this._y,
i = this._z,
a = this._w,
o = a * e._w + n * e._x + r * e._y + i * e._z;
if (o < 0 ? (this._w = -e._w, this._x = -e._x, this._y = -e._y, this._z = -e._z, o = -o) : this.copy(e), o >= 1) return this._w = a, this._x = n, this._y = r, this._z = i, this;
var s = 1 - o * o;
if (s <= Number.EPSILON) {
var c = 1 - t;
return this._w = c * a + t * this._w, this._x = c * n + t * this._x, this._y = c * r + t * this._y, this._z = c * i + t * this._z, this.normalize(), this._onChangeCallback(), this
}
var l = Math.sqrt(s),
h = Math.atan2(l, o),
u = Math.sin((1 - t) * h) / l,
p = Math.sin(t * h) / l;
return this._w = a * u + this._w * p, this._x = n * u + this._x * p, this._y = r * u + this._y * p, this._z = i * u + this._z * p, this._onChangeCallback(), this
},
equals: function(e) {
return e._x === this._x && e._y === this._y && e._z === this._z && e._w === this._w
},
fromArray: function(e, t) {
return void 0 === t && (t = 0), this._x = e[t], this._y = e[t + 1], this._z = e[t + 2], this._w = e[t + 3], this._onChangeCallback(), this
},
toArray: function(e, t) {
return void 0 === e && (e = []), void 0 === t && (t = 0), e[t] = this._x, e[t + 1] = this._y, e[t + 2] = this._z, e[t + 3] = this._w, e
},
_onChange: function(e) {
return this._onChangeCallback = e, this
},
_onChangeCallback: function() {}
});
var hl = new i,
ul = new r;
Object.assign(i.prototype, {
isVector3: !0,
set: function(e, t, n) {
return this.x = e, this.y = t, this.z = n, this
},
setScalar: function(e) {
return this.x = e, this.y = e, this.z = e, this
},
setX: function(e) {
return this.x = e, this
},
setY: function(e) {
return this.y = e, this
},
setZ: function(e) {
return this.z = e, this
},
setComponent: function(e, t) {
switch (e) {
case 0:
this.x = t;
break;
case 1:
this.y = t;
break;
case 2:
this.z = t;
break;
default:
throw new Error("index is out of range: " + e)
}
return this
},
getComponent: function(e) {
switch (e) {
case 0:
return this.x;
case 1:
return this.y;
case 2:
return this.z;
default:
throw new Error("index is out of range: " + e)
}
},
clone: function() {
return new this.constructor(this.x, this.y, this.z)
},
copy: function(e) {
return this.x = e.x, this.y = e.y, this.z = e.z, this
},
add: function(e, t) {
return void 0 !== t ? (console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."), this.addVectors(e, t)) : (this.x += e.x, this.y += e.y, this.z += e.z, this)
},
addScalar: function(e) {
return this.x += e, this.y += e, this.z += e, this
},
addVectors: function(e, t) {
return this.x = e.x + t.x, this.y = e.y + t.y, this.z = e.z + t.z, this
},
addScaledVector: function(e, t) {
return this.x += e.x * t, this.y += e.y * t, this.z += e.z * t, this
},
sub: function(e, t) {
return void 0 !== t ? (console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."), this.subVectors(e, t)) : (this.x -= e.x, this.y -= e.y, this.z -= e.z, this)
},
subScalar: function(e) {
return this.x -= e, this.y -= e, this.z -= e, this
},
subVectors: function(e, t) {
return this.x = e.x - t.x, this.y = e.y - t.y, this.z = e.z - t.z, this
},
multiply: function(e, t) {
return void 0 !== t ? (console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."), this.multiplyVectors(e, t)) : (this.x *= e.x, this.y *= e.y, this.z *= e.z, this)
},
multiplyScalar: function(e) {
return this.x *= e, this.y *= e, this.z *= e, this
},
multiplyVectors: function(e, t) {
return this.x = e.x * t.x, this.y = e.y * t.y, this.z = e.z * t.z, this
},
applyEuler: function(e) {
return e && e.isEuler || console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."), this.applyQuaternion(ul.setFromEuler(e))
},
applyAxisAngle: function(e, t) {
return this.applyQuaternion(ul.setFromAxisAngle(e, t))
},
applyMatrix3: function(e) {
var t = this.x,
n = this.y,
r = this.z,
i = e.elements;
return this.x = i[0] * t + i[3] * n + i[6] * r, this.y = i[1] * t + i[4] * n + i[7] * r, this.z = i[2] * t + i[5] * n + i[8] * r, this
},
applyNormalMatrix: function(e) {
return this.applyMatrix3(e).normalize()
},
applyMatrix4: function(e) {
var t = this.x,
n = this.y,
r = this.z,
i = e.elements,
a = 1 / (i[3] * t + i[7] * n + i[11] * r + i[15]);
return this.x = (i[0] * t + i[4] * n + i[8] * r + i[12]) * a, this.y = (i[1] * t + i[5] * n + i[9] * r + i[13]) * a, this.z = (i[2] * t + i[6] * n + i[10] * r + i[14]) * a, this
},
applyQuaternion: function(e) {
var t = this.x,
n = this.y,
r = this.z,
i = e.x,
a = e.y,
o = e.z,
s = e.w,
c = s * t + a * r - o * n,
l = s * n + o * t - i * r,
h = s * r + i * n - a * t,
u = -i * t - a * n - o * r;
return this.x = c * s + u * -i + l * -o - h * -a, this.y = l * s + u * -a + h * -i - c * -o, this.z = h * s + u * -o + c * -a - l * -i, this
},
project: function(e) {
return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)
},
unproject: function(e) {
return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)
},
transformDirection: function(e) {
var t = this.x,
n = this.y,
r = this.z,
i = e.elements;
return this.x = i[0] * t + i[4] * n + i[8] * r, this.y = i[1] * t + i[5] * n + i[9] * r, this.z = i[2] * t + i[6] * n + i[10] * r, this.normalize()
},
divide: function(e) {
return this.x /= e.x, this.y /= e.y, this.z /= e.z, this
},
divideScalar: function(e) {
return this.multiplyScalar(1 / e)
},
min: function(e) {
return this.x = Math.min(this.x, e.x), this.y = Math.min(this.y, e.y), this.z = Math.min(this.z, e.z), this
},
max: function(e) {
return this.x = Math.max(this.x, e.x), this.y = Math.max(this.y, e.y), this.z = Math.max(this.z, e.z), this
},
clamp: function(e, t) {
return this.x = Math.max(e.x, Math.min(t.x, this.x)), this.y = Math.max(e.y, Math.min(t.y, this.y)), this.z = Math.max(e.z, Math.min(t.z, this.z)), this
},
clampScalar: function(e, t) {
return this.x = Math.max(e, Math.min(t, this.x)), this.y = Math.max(e, Math.min(t, this.y)), this.z = Math.max(e, Math.min(t, this.z)), this
},
clampLength: function(e, t) {
var n = this.length();
return this.divideScalar(n || 1).multiplyScalar(Math.max(e, Math.min(t, n)))
},
floor: function() {
return this.x = Math.floor(this.x), this.y = Math.floor(this.y), this.z = Math.floor(this.z), this
},
ceil: function() {
return this.x = Math.ceil(this.x), this.y = Math.ceil(this.y), this.z = Math.ceil(this.z), this
},
round: function() {
return this.x = Math.round(this.x), this.y = Math.round(this.y), this.z = Math.round(this.z), this
},
roundToZero: function() {
return this.x = this.x < 0 ? Math.ceil(this.x) : Math.floor(this.x), this.y = this.y < 0 ? Math.ceil(this.y) : Math.floor(this.y), this.z = this.z < 0 ? Math.ceil(this.z) : Math.floor(this.z), this
},
negate: function() {
return this.x = -this.x, this.y = -this.y, this.z = -this.z, this
},
dot: function(e) {
return this.x * e.x + this.y * e.y + this.z * e.z
},
lengthSq: function() {
return this.x * this.x + this.y * this.y + this.z * this.z
},
length: function() {
return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z)
},
manhattanLength: function() {
return Math.abs(this.x) + Math.abs(this.y) + Math.abs(this.z)
},
normalize: function() {
return this.divideScalar(this.length() || 1)
},
setLength: function(e) {
return this.normalize().multiplyScalar(e)
},
lerp: function(e, t) {
return this.x += (e.x - this.x) * t, this.y += (e.y - this.y) * t, this.z += (e.z - this.z) * t, this
},
lerpVectors: function(e, t, n) {
return this.subVectors(t, e).multiplyScalar(n).add(e)
},
cross: function(e, t) {
return void 0 !== t ? (console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."), this.crossVectors(e, t)) : this.crossVectors(this, e)
},
crossVectors: function(e, t) {
var n = e.x,
r = e.y,
i = e.z,
a = t.x,
o = t.y,
s = t.z;
return this.x = r * s - i * o, this.y = i * a - n * s, this.z = n * o - r * a, this
},
projectOnVector: function(e) {
var t = e.dot(this) / e.lengthSq();
return this.copy(e).multiplyScalar(t)
},
projectOnPlane: function(e) {
return hl.copy(this).projectOnVector(e), this.sub(hl)
},
reflect: function(e) {
return this.sub(hl.copy(e).multiplyScalar(2 * this.dot(e)))
},
angleTo: function(e) {
var t = Math.sqrt(this.lengthSq() * e.lengthSq());
0 === t && console.error("THREE.Vector3: angleTo() can' t handle zero length vectors."); var n=this.dot(e) / t; return Math.acos(ll.clamp(n, -1, 1)) }, distanceTo: function(e) { return Math.sqrt(this.distanceToSquared(e)) }, distanceToSquared: function(e) { var t=this.x - e.x, n=this.y - e.y, r=this.z - e.z; return t * t + n * n + r * r }, manhattanDistanceTo: function(e) { return Math.abs(this.x - e.x) + Math.abs(this.y - e.y) + Math.abs(this.z - e.z) }, setFromSpherical: function(e) { return this.setFromSphericalCoords(e.radius, e.phi, e.theta) }, setFromSphericalCoords: function(e, t, n) { var r=Math.sin(t) * e; return this.x=r * Math.sin(n), this.y=Math.cos(t) * e, this.z=r * Math.cos(n), this }, setFromCylindrical: function(e) { return this.setFromCylindricalCoords(e.radius, e.theta, e.y) }, setFromCylindricalCoords: function(e, t, n) { return this.x=e * Math.sin(t), this.y=n, this.z=e * Math.cos(t), this }, setFromMatrixPosition: function(e) { var t=e.elements; return this.x=t[12], this.y=t[13], this.z=t[14], this }, setFromMatrixScale: function(e) { var t=this.setFromMatrixColumn(e, 0).length(), n=this.setFromMatrixColumn(e, 1).length(), r=this.setFromMatrixColumn(e, 2).length(); return this.x=t, this.y=n, this.z=r, this }, setFromMatrixColumn: function(e, t) { return this.fromArray(e.elements, 4 * t) }, equals: function(e) { return e.x===this.x && e.y===this.y && e.z===this.z }, fromArray: function(e, t) { return void 0===t && (t=0), this.x=e[t], this.y=e[t + 1], this.z=e[t + 2], this }, toArray: function(e, t) { return void 0===e && (e=[]), void 0===t && (t=0), e[t]=this.x, e[t + 1]=this.y, e[t + 2]=this.z, e }, fromBufferAttribute: function(e, t, n) { return void 0 !==n && console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."), this.x=e.getX(t), this.y=e.getY(t), this.z=e.getZ(t), this } }); var pl=new i; Object.assign(a.prototype, { isMatrix3: !0, set: function(e, t, n, r, i, a, o, s, c) { var l=this.elements; return l[0]=e, l[1]=r, l[2]=o, l[3]=t, l[4]=i, l[5]=s, l[6]=n, l[7]=a, l[8]=c, this }, identity: function() { return this.set(1, 0, 0, 0, 1, 0, 0, 0, 1), this }, clone: function() { return (new this.constructor).fromArray(this.elements) }, copy: function(e) { var t=this.elements, n=e.elements; return t[0]=n[0], t[1]=n[1], t[2]=n[2], t[3]=n[3], t[4]=n[4], t[5]=n[5], t[6]=n[6], t[7]=n[7], t[8]=n[8], this }, setFromMatrix4: function(e) { var t=e.elements; return this.set(t[0], t[4], t[8], t[1], t[5], t[9], t[2], t[6], t[10]), this }, applyToBufferAttribute: function(e) { for (var t=0, n=e.count; t < n; t++) pl.x=e.getX(t), pl.y=e.getY(t), pl.z=e.getZ(t), pl.applyMatrix3(this), e.setXYZ(t, pl.x, pl.y, pl.z); return e }, multiply: function(e) { return this.multiplyMatrices(this, e) }, premultiply: function(e) { return this.multiplyMatrices(e, this) }, multiplyMatrices: function(e, t) { var n=e.elements, r=t.elements, i=this.elements, a=n[0], o=n[3], s=n[6], c=n[1], l=n[4], h=n[7], u=n[2], p=n[5], d=n[8], f=r[0], m=r[3], v=r[6], g=r[1], y=r[4], x=r[7], b=r[2], w=r[5], _=r[8]; return i[0]=a * f + o * g + s * b, i[3]=a * m + o * y + s * w, i[6]=a * v + o * x + s * _, i[1]=c * f + l * g + h * b, i[4]=c * m + l * y + h * w, i[7]=c * v + l * x + h * _, i[2]=u * f + p * g + d * b, i[5]=u * m + p * y + d * w, i[8]=u * v + p * x + d * _, this }, multiplyScalar: function(e) { var t=this.elements; return t[0] *=e, t[3] *=e, t[6] *=e, t[1] *=e, t[4] *=e, t[7] *=e, t[2] *=e, t[5] *=e, t[8] *=e, this }, determinant: function() { var e=this.elements, t=e[0], n=e[1], r=e[2], i=e[3], a=e[4], o=e[5], s=e[6], c=e[7], l=e[8]; return t * a * l - t * o * c - n * i * l + n * o * s + r * i * c - r * a * s }, getInverse: function(e, t) { e && e.isMatrix4 && console.error("THREE.Matrix3: .getInverse() no longer takes a Matrix4 argument."); var n=e.elements, r=this.elements, i=n[0], a=n[1], o=n[2], s=n[3], c=n[4], l=n[5], h=n[6], u=n[7], p=n[8], d=p * c - l * u, f=l * h - p * s, m=u * s - c * h, v=i * d + a * f + o * m; if (0===v) { var g="THREE.Matrix3: .getInverse() can't invert matrix, determinant is 0" ; if (!0===t) throw new Error(g); return console.warn(g), this.identity() } var y=1 / v; return r[0]=d * y, r[1]=(o * u - p * a) * y, r[2]=(l * a - o * c) * y, r[3]=f * y, r[4]=(p * i - o * h) * y, r[5]=(o * s - l * i) * y, r[6]=m * y, r[7]=(a * h - u * i) * y, r[8]=(c * i - a * s) * y, this }, transpose: function() { var e, t=this.elements; return e=t[1], t[1]=t[3], t[3]=e, e=t[2], t[2]=t[6], t[6]=e, e=t[5], t[5]=t[7], t[7]=e, this }, getNormalMatrix: function(e) { return this.setFromMatrix4(e).getInverse(this).transpose() }, transposeIntoArray: function(e) { var t=this.elements; return e[0]=t[0], e[1]=t[3], e[2]=t[6], e[3]=t[1], e[4]=t[4], e[5]=t[7], e[6]=t[2], e[7]=t[5], e[8]=t[8], this }, setUvTransform: function(e, t, n, r, i, a, o) { var s=Math.cos(i), c=Math.sin(i); this.set(n * s, n * c, -n * (s * a + c * o) + a + e, -r * c, r * s, -r * (-c * a + s * o) + o + t, 0, 0, 1) }, scale: function(e, t) { var n=this.elements; return n[0] *=e, n[3] *=e, n[6] *=e, n[1] *=t, n[4] *=t, n[7] *=t, this }, rotate: function(e) { var t=Math.cos(e), n=Math.sin(e), r=this.elements, i=r[0], a=r[3], o=r[6], s=r[1], c=r[4], l=r[7]; return r[0]=t * i + n * s, r[3]=t * a + n * c, r[6]=t * o + n * l, r[1]=-n * i + t * s, r[4]=-n * a + t * c, r[7]=-n * o + t * l, this }, translate: function(e, t) { var n=this.elements; return n[0] +=e * n[2], n[3] +=e * n[5], n[6] +=e * n[8], n[1] +=t * n[2], n[4] +=t * n[5], n[7] +=t * n[8], this }, equals: function(e) { for (var t=this.elements, n=e.elements, r=0; r < 9; r++) if (t[r] !==n[r]) return !1; return !0 }, fromArray: function(e, t) { void 0===t && (t=0); for (var n=0; n < 9; n++) this.elements[n]=e[n + t]; return this }, toArray: function(e, t) { void 0===e && (e=[]), void 0===t && (t=0); var n=this.elements; return e[t]=n[0], e[t + 1]=n[1], e[t + 2]=n[2], e[t + 3]=n[3], e[t + 4]=n[4], e[t + 5]=n[5], e[t + 6]=n[6], e[t + 7]=n[7], e[t + 8]=n[8], e } }); var dl, fl={ getDataURL: function(e) { var t; if ("undefined"==typeof HTMLCanvasElement) return e.src; if (e instanceof HTMLCanvasElement) t=e; else { void 0===dl && (dl=document.createElementNS("http://www.w3.org/1999/xhtml", "canvas" )), dl.width=e.width, dl.height=e.height; var n=dl.getContext("2d"); e instanceof ImageData ? n.putImageData(e, 0, 0) : n.drawImage(e, 0, 0, e.width, e.height), t=dl } return t.width> 2048 || t.height > 2048 ? t.toDataURL("image/jpeg", .6) : t.toDataURL("image/png")
}
},
ml = 0;
o.DEFAULT_IMAGE = void 0, o.DEFAULT_MAPPING = 300, o.prototype = Object.assign(Object.create(t.prototype), {
constructor: o,
isTexture: !0,
updateMatrix: function() {
this.matrix.setUvTransform(this.offset.x, this.offset.y, this.repeat.x, this.repeat.y, this.rotation, this.center.x, this.center.y)
},
clone: function() {
return (new this.constructor).copy(this)
},
copy: function(e) {
return this.name = e.name, this.image = e.image, this.mipmaps = e.mipmaps.slice(0), this.mapping = e.mapping, this.wrapS = e.wrapS, this.wrapT = e.wrapT, this.magFilter = e.magFilter, this.minFilter = e.minFilter, this.anisotropy = e.anisotropy, this.format = e.format, this.type = e.type, this.offset.copy(e.offset), this.repeat.copy(e.repeat), this.center.copy(e.center), this.rotation = e.rotation, this.matrixAutoUpdate = e.matrixAutoUpdate, this.matrix.copy(e.matrix), this.generateMipmaps = e.generateMipmaps, this.premultiplyAlpha = e.premultiplyAlpha, this.flipY = e.flipY, this.unpackAlignment = e.unpackAlignment, this.encoding = e.encoding, this
},
toJSON: function(e) {
var t = void 0 === e || "string" == typeof e;
if (!t && void 0 !== e.textures[this.uuid]) return e.textures[this.uuid];
var n = {
metadata: {
version: 4.5,
type: "Texture",
generator: "Texture.toJSON"
},
uuid: this.uuid,
name: this.name,
mapping: this.mapping,
repeat: [this.repeat.x, this.repeat.y],
offset: [this.offset.x, this.offset.y],
center: [this.center.x, this.center.y],
rotation: this.rotation,
wrap: [this.wrapS, this.wrapT],
format: this.format,
type: this.type,
encoding: this.encoding,
minFilter: this.minFilter,
magFilter: this.magFilter,
anisotropy: this.anisotropy,
flipY: this.flipY,
premultiplyAlpha: this.premultiplyAlpha,
unpackAlignment: this.unpackAlignment
};
if (void 0 !== this.image) {
var r = this.image;
if (void 0 === r.uuid && (r.uuid = ll.generateUUID()), !t && void 0 === e.images[r.uuid]) {
var i;
if (Array.isArray(r)) {
i = [];
for (var a = 0, o = r.length; a < o; a++) i.push(fl.getDataURL(r[a])) } else i=fl.getDataURL(r); e.images[r.uuid]={ uuid: r.uuid, url: i } } n.image=r.uuid } return t || (e.textures[this.uuid]=n), n }, dispose: function() { this.dispatchEvent({ type: "dispose" }) }, transformUv: function(e) { if (300 !==this.mapping) return e; if (e.applyMatrix3(this.matrix), e.x < 0 || e.x> 1) switch (this.wrapS) {
case Ws:
e.x = e.x - Math.floor(e.x);
break;
case qs:
e.x = e.x < 0 ? 0 : 1; break; case Xs: 1===Math.abs(Math.floor(e.x) % 2) ? e.x=Math.ceil(e.x) - e.x : e.x=e.x - Math.floor(e.x) } if (e.y < 0 || e.y> 1) switch (this.wrapT) {
case Ws:
e.y = e.y - Math.floor(e.y);
break;
case qs:
e.y = e.y < 0 ? 0 : 1; break; case Xs: 1===Math.abs(Math.floor(e.y) % 2) ? e.y=Math.ceil(e.y) - e.y : e.y=e.y - Math.floor(e.y) } return this.flipY && (e.y=1 - e.y), e } }), Object.defineProperty(o.prototype, "needsUpdate" , { set: function(e) { !0===e && this.version++ } }), Object.defineProperties(s.prototype, { width: { get: function() { return this.z }, set: function(e) { this.z=e } }, height: { get: function() { return this.w }, set: function(e) { this.w=e } } }), Object.assign(s.prototype, { isVector4: !0, set: function(e, t, n, r) { return this.x=e, this.y=t, this.z=n, this.w=r, this }, setScalar: function(e) { return this.x=e, this.y=e, this.z=e, this.w=e, this }, setX: function(e) { return this.x=e, this }, setY: function(e) { return this.y=e, this }, setZ: function(e) { return this.z=e, this }, setW: function(e) { return this.w=e, this }, setComponent: function(e, t) { switch (e) { case 0: this.x=t; break; case 1: this.y=t; break; case 2: this.z=t; break; case 3: this.w=t; break; default: throw new Error("index is out of range: " + e)
}
return this
},
getComponent: function(e) {
switch (e) {
case 0:
return this.x;
case 1:
return this.y;
case 2:
return this.z;
case 3:
return this.w;
default:
throw new Error(" index is out of range: " + e)
}
},
clone: function() {
return new this.constructor(this.x, this.y, this.z, this.w)
},
copy: function(e) {
return this.x = e.x, this.y = e.y, this.z = e.z, this.w = void 0 !== e.w ? e.w : 1, this
},
add: function(e, t) {
return void 0 !== t ? (console.warn(" THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."), this.addVectors(e, t)) : (this.x +=e.x, this.y +=e.y, this.z +=e.z, this.w +=e.w, this) }, addScalar: function(e) { return this.x +=e, this.y +=e, this.z +=e, this.w +=e, this }, addVectors: function(e, t) { return this.x=e.x + t.x, this.y=e.y + t.y, this.z=e.z + t.z, this.w=e.w + t.w, this }, addScaledVector: function(e, t) { return this.x +=e.x * t, this.y +=e.y * t, this.z +=e.z * t, this.w +=e.w * t, this }, sub: function(e, t) { return void 0 !==t ? (console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."), this.subVectors(e, t)) : (this.x -=e.x, this.y -=e.y, this.z -=e.z, this.w -=e.w, this) }, subScalar: function(e) { return this.x -=e, this.y -=e, this.z -=e, this.w -=e, this }, subVectors: function(e, t) { return this.x=e.x - t.x, this.y=e.y - t.y, this.z=e.z - t.z, this.w=e.w - t.w, this }, multiplyScalar: function(e) { return this.x *=e, this.y *=e, this.z *=e, this.w *=e, this }, applyMatrix4: function(e) { var t=this.x, n=this.y, r=this.z, i=this.w, a=e.elements; return this.x=a[0] * t + a[4] * n + a[8] * r + a[12] * i, this.y=a[1] * t + a[5] * n + a[9] * r + a[13] * i, this.z=a[2] * t + a[6] * n + a[10] * r + a[14] * i, this.w=a[3] * t + a[7] * n + a[11] * r + a[15] * i, this }, divideScalar: function(e) { return this.multiplyScalar(1 / e) }, setAxisAngleFromQuaternion: function(e) { this.w=2 * Math.acos(e.w); var t=Math.sqrt(1 - e.w * e.w); return t < 1e-4 ? (this.x=1, this.y=0, this.z=0) : (this.x=e.x / t, this.y=e.y / t, this.z=e.z / t), this }, setAxisAngleFromRotationMatrix: function(e) { var t, n, r, i, a=e.elements, o=a[0], s=a[4], c=a[8], l=a[1], h=a[5], u=a[9], p=a[2], d=a[6], f=a[10]; if (Math.abs(s - l) < .01 && Math.abs(c - p) < .01 && Math.abs(u - d) < .01) { if (Math.abs(s + l) < .1 && Math.abs(c + p) < .1 && Math.abs(u + d) < .1 && Math.abs(o + h + f - 3) < .1) return this.set(1, 0, 0, 0), this; t=Math.PI; var m=(o + 1) / 2, v=(h + 1) / 2, g=(f + 1) / 2, y=(s + l) / 4, x=(c + p) / 4, b=(u + d) / 4; return m> v && m > g ? m < .01 ? (n=0, r=.707106781, i=.707106781) : (n=Math.sqrt(m), r=y / n, i=x / n) : v> g ? v < .01 ? (n=.707106781, r=0, i=.707106781) : (r=Math.sqrt(v), n=y / r, i=b / r) : g < .01 ? (n=.707106781, r=.707106781, i=0) : (i=Math.sqrt(g), n=x / i, r=b / i), this.set(n, r, i, t), this } var w=Math.sqrt((d - u) * (d - u) + (c - p) * (c - p) + (l - s) * (l - s)); return Math.abs(w) < .001 && (w=1), this.x=(d - u) / w, this.y=(c - p) / w, this.z=(l - s) / w, this.w=Math.acos((o + h + f - 1) / 2), this }, min: function(e) { return this.x=Math.min(this.x, e.x), this.y=Math.min(this.y, e.y), this.z=Math.min(this.z, e.z), this.w=Math.min(this.w, e.w), this }, max: function(e) { return this.x=Math.max(this.x, e.x), this.y=Math.max(this.y, e.y), this.z=Math.max(this.z, e.z), this.w=Math.max(this.w, e.w), this }, clamp: function(e, t) { return this.x=Math.max(e.x, Math.min(t.x, this.x)), this.y=Math.max(e.y, Math.min(t.y, this.y)), this.z=Math.max(e.z, Math.min(t.z, this.z)), this.w=Math.max(e.w, Math.min(t.w, this.w)), this }, clampScalar: function(e, t) { return this.x=Math.max(e, Math.min(t, this.x)), this.y=Math.max(e, Math.min(t, this.y)), this.z=Math.max(e, Math.min(t, this.z)), this.w=Math.max(e, Math.min(t, this.w)), this }, clampLength: function(e, t) { var n=this.length(); return this.divideScalar(n || 1).multiplyScalar(Math.max(e, Math.min(t, n))) }, floor: function() { return this.x=Math.floor(this.x), this.y=Math.floor(this.y), this.z=Math.floor(this.z), this.w=Math.floor(this.w), this }, ceil: function() { return this.x=Math.ceil(this.x), this.y=Math.ceil(this.y), this.z=Math.ceil(this.z), this.w=Math.ceil(this.w), this }, round: function() { return this.x=Math.round(this.x), this.y=Math.round(this.y), this.z=Math.round(this.z), this.w=Math.round(this.w), this }, roundToZero: function() { return this.x=this.x < 0 ? Math.ceil(this.x) : Math.floor(this.x), this.y=this.y < 0 ? Math.ceil(this.y) : Math.floor(this.y), this.z=this.z < 0 ? Math.ceil(this.z) : Math.floor(this.z), this.w=this.w < 0 ? Math.ceil(this.w) : Math.floor(this.w), this }, negate: function() { return this.x=-this.x, this.y=-this.y, this.z=-this.z, this.w=-this.w, this }, dot: function(e) { return this.x * e.x + this.y * e.y + this.z * e.z + this.w * e.w }, lengthSq: function() { return this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w }, length: function() { return Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z + this.w * this.w) }, manhattanLength: function() { return Math.abs(this.x) + Math.abs(this.y) + Math.abs(this.z) + Math.abs(this.w) }, normalize: function() { return this.divideScalar(this.length() || 1) }, setLength: function(e) { return this.normalize().multiplyScalar(e) }, lerp: function(e, t) { return this.x +=(e.x - this.x) * t, this.y +=(e.y - this.y) * t, this.z +=(e.z - this.z) * t, this.w +=(e.w - this.w) * t, this }, lerpVectors: function(e, t, n) { return this.subVectors(t, e).multiplyScalar(n).add(e) }, equals: function(e) { return e.x===this.x && e.y===this.y && e.z===this.z && e.w===this.w }, fromArray: function(e, t) { return void 0===t && (t=0), this.x=e[t], this.y=e[t + 1], this.z=e[t + 2], this.w=e[t + 3], this }, toArray: function(e, t) { return void 0===e && (e=[]), void 0===t && (t=0), e[t]=this.x, e[t + 1]=this.y, e[t + 2]=this.z, e[t + 3]=this.w, e }, fromBufferAttribute: function(e, t, n) { return void 0 !==n && console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."), this.x=e.getX(t), this.y=e.getY(t), this.z=e.getZ(t), this.w=e.getW(t), this } }), c.prototype=Object.assign(Object.create(t.prototype), { constructor: c, isWebGLRenderTarget: !0, setSize: function(e, t) { this.width===e && this.height===t || (this.width=e, this.height=t, this.texture.image.width=e, this.texture.image.height=t, this.dispose()), this.viewport.set(0, 0, e, t), this.scissor.set(0, 0, e, t) }, clone: function() { return (new this.constructor).copy(this) }, copy: function(e) { return this.width=e.width, this.height=e.height, this.viewport.copy(e.viewport), this.texture=e.texture.clone(), this.depthBuffer=e.depthBuffer, this.stencilBuffer=e.stencilBuffer, this.depthTexture=e.depthTexture, this }, dispose: function() { this.dispatchEvent({ type: "dispose" }) } }), l.prototype=Object.assign(Object.create(c.prototype), { constructor: l, isWebGLMultisampleRenderTarget: !0, copy: function(e) { return c.prototype.copy.call(this, e), this.samples=e.samples, this } }); var vl=new i, gl=new h, yl=new i(0, 0, 0), xl=new i(1, 1, 1), bl=new i, wl=new i, _l=new i; Object.assign(h.prototype, { isMatrix4: !0, set: function(e, t, n, r, i, a, o, s, c, l, h, u, p, d, f, m) { var v=this.elements; return v[0]=e, v[4]=t, v[8]=n, v[12]=r, v[1]=i, v[5]=a, v[9]=o, v[13]=s, v[2]=c, v[6]=l, v[10]=h, v[14]=u, v[3]=p, v[7]=d, v[11]=f, v[15]=m, this }, identity: function() { return this.set(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1), this }, clone: function() { return (new h).fromArray(this.elements) }, copy: function(e) { var t=this.elements, n=e.elements; return t[0]=n[0], t[1]=n[1], t[2]=n[2], t[3]=n[3], t[4]=n[4], t[5]=n[5], t[6]=n[6], t[7]=n[7], t[8]=n[8], t[9]=n[9], t[10]=n[10], t[11]=n[11], t[12]=n[12], t[13]=n[13], t[14]=n[14], t[15]=n[15], this }, copyPosition: function(e) { var t=this.elements, n=e.elements; return t[12]=n[12], t[13]=n[13], t[14]=n[14], this }, extractBasis: function(e, t, n) { return e.setFromMatrixColumn(this, 0), t.setFromMatrixColumn(this, 1), n.setFromMatrixColumn(this, 2), this }, makeBasis: function(e, t, n) { return this.set(e.x, t.x, n.x, 0, e.y, t.y, n.y, 0, e.z, t.z, n.z, 0, 0, 0, 0, 1), this }, extractRotation: function(e) { var t=this.elements, n=e.elements, r=1 / vl.setFromMatrixColumn(e, 0).length(), i=1 / vl.setFromMatrixColumn(e, 1).length(), a=1 / vl.setFromMatrixColumn(e, 2).length(); return t[0]=n[0] * r, t[1]=n[1] * r, t[2]=n[2] * r, t[3]=0, t[4]=n[4] * i, t[5]=n[5] * i, t[6]=n[6] * i, t[7]=0, t[8]=n[8] * a, t[9]=n[9] * a, t[10]=n[10] * a, t[11]=0, t[12]=0, t[13]=0, t[14]=0, t[15]=1, this }, makeRotationFromEuler: function(e) { e && e.isEuler || console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order."); var t=this.elements, n=e.x, r=e.y, i=e.z, a=Math.cos(n), o=Math.sin(n), s=Math.cos(r), c=Math.sin(r), l=Math.cos(i), h=Math.sin(i); if ("XYZ"===e.order) { var u=a * l, p=a * h, d=o * l, f=o * h; t[0]=s * l, t[4]=-s * h, t[8]=c, t[1]=p + d * c, t[5]=u - f * c, t[9]=-o * s, t[2]=f - u * c, t[6]=d + p * c, t[10]=a * s } else if ("YXZ"===e.order) { var m=s * l, v=s * h, g=c * l, y=c * h; t[0]=m + y * o, t[4]=g * o - v, t[8]=a * c, t[1]=a * h, t[5]=a * l, t[9]=-o, t[2]=v * o - g, t[6]=y + m * o, t[10]=a * s } else if ("ZXY"===e.order) { var m=s * l, v=s * h, g=c * l, y=c * h; t[0]=m - y * o, t[4]=-a * h, t[8]=g + v * o, t[1]=v + g * o, t[5]=a * l, t[9]=y - m * o, t[2]=-a * c, t[6]=o, t[10]=a * s } else if ("ZYX"===e.order) { var u=a * l, p=a * h, d=o * l, f=o * h; t[0]=s * l, t[4]=d * c - p, t[8]=u * c + f, t[1]=s * h, t[5]=f * c + u, t[9]=p * c - d, t[2]=-c, t[6]=o * s, t[10]=a * s } else if ("YZX"===e.order) { var x=a * s, b=a * c, w=o * s, _=o * c; t[0]=s * l, t[4]=_ - x * h, t[8]=w * h + b, t[1]=h, t[5]=a * l, t[9]=-o * l, t[2]=-c * l, t[6]=b * h + w, t[10]=x - _ * h } else if ("XZY"===e.order) { var x=a * s, b=a * c, w=o * s, _=o * c; t[0]=s * l, t[4]=-h, t[8]=c * l, t[1]=x * h + _, t[5]=a * l, t[9]=b * h - w, t[2]=w * h - b, t[6]=o * l, t[10]=_ * h + x } return t[3]=0, t[7]=0, t[11]=0, t[12]=0, t[13]=0, t[14]=0, t[15]=1, this }, makeRotationFromQuaternion: function(e) { return this.compose(yl, e, xl) }, lookAt: function(e, t, n) { var r=this.elements; return _l.subVectors(e, t), 0===_l.lengthSq() && (_l.z=1), _l.normalize(), bl.crossVectors(n, _l), 0===bl.lengthSq() && (1===Math.abs(n.z) ? _l.x +=1e-4 : _l.z +=1e-4, _l.normalize(), bl.crossVectors(n, _l)), bl.normalize(), wl.crossVectors(_l, bl), r[0]=bl.x, r[4]=wl.x, r[8]=_l.x, r[1]=bl.y, r[5]=wl.y, r[9]=_l.y, r[2]=bl.z, r[6]=wl.z, r[10]=_l.z, this }, multiply: function(e, t) { return void 0 !==t ? (console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."), this.multiplyMatrices(e, t)) : this.multiplyMatrices(this, e) }, premultiply: function(e) { return this.multiplyMatrices(e, this) }, multiplyMatrices: function(e, t) { var n=e.elements, r=t.elements, i=this.elements, a=n[0], o=n[4], s=n[8], c=n[12], l=n[1], h=n[5], u=n[9], p=n[13], d=n[2], f=n[6], m=n[10], v=n[14], g=n[3], y=n[7], x=n[11], b=n[15], w=r[0], _=r[4], M=r[8], S=r[12], T=r[1], E=r[5], A=r[9], L=r[13], R=r[2], P=r[6], C=r[10], O=r[14], D=r[3], I=r[7], N=r[11], z=r[15]; return i[0]=a * w + o * T + s * R + c * D, i[4]=a * _ + o * E + s * P + c * I, i[8]=a * M + o * A + s * C + c * N, i[12]=a * S + o * L + s * O + c * z, i[1]=l * w + h * T + u * R + p * D, i[5]=l * _ + h * E + u * P + p * I, i[9]=l * M + h * A + u * C + p * N, i[13]=l * S + h * L + u * O + p * z, i[2]=d * w + f * T + m * R + v * D, i[6]=d * _ + f * E + m * P + v * I, i[10]=d * M + f * A + m * C + v * N, i[14]=d * S + f * L + m * O + v * z, i[3]=g * w + y * T + x * R + b * D, i[7]=g * _ + y * E + x * P + b * I, i[11]=g * M + y * A + x * C + b * N, i[15]=g * S + y * L + x * O + b * z, this }, multiplyScalar: function(e) { var t=this.elements; return t[0] *=e, t[4] *=e, t[8] *=e, t[12] *=e, t[1] *=e, t[5] *=e, t[9] *=e, t[13] *=e, t[2] *=e, t[6] *=e, t[10] *=e, t[14] *=e, t[3] *=e, t[7] *=e, t[11] *=e, t[15] *=e, this }, applyToBufferAttribute: function(e) { for (var t=0, n=e.count; t < n; t++) vl.x=e.getX(t), vl.y=e.getY(t), vl.z=e.getZ(t), vl.applyMatrix4(this), e.setXYZ(t, vl.x, vl.y, vl.z); return e }, determinant: function() { var e=this.elements, t=e[0], n=e[4], r=e[8], i=e[12], a=e[1], o=e[5], s=e[9], c=e[13], l=e[2], h=e[6], u=e[10], p=e[14]; return e[3] * (+i * s * h - r * c * h - i * o * u + n * c * u + r * o * p - n * s * p) + e[7] * (+t * s * p - t * c * u + i * a * u - r * a * p + r * c * l - i * s * l) + e[11] * (+t * c * h - t * o * p - i * a * h + n * a * p + i * o * l - n * c * l) + e[15] * (-r * o * l - t * s * h + t * o * u + r * a * h - n * a * u + n * s * l) }, transpose: function() { var e, t=this.elements; return e=t[1], t[1]=t[4], t[4]=e, e=t[2], t[2]=t[8], t[8]=e, e=t[6], t[6]=t[9], t[9]=e, e=t[3], t[3]=t[12], t[12]=e, e=t[7], t[7]=t[13], t[13]=e, e=t[11], t[11]=t[14], t[14]=e, this }, setPosition: function(e, t, n) { var r=this.elements; return e.isVector3 ? (r[12]=e.x, r[13]=e.y, r[14]=e.z) : (r[12]=e, r[13]=t, r[14]=n), this }, getInverse: function(e, t) { var n=this.elements, r=e.elements, i=r[0], a=r[1], o=r[2], s=r[3], c=r[4], l=r[5], h=r[6], u=r[7], p=r[8], d=r[9], f=r[10], m=r[11], v=r[12], g=r[13], y=r[14], x=r[15], b=d * y * u - g * f * u + g * h * m - l * y * m - d * h * x + l * f * x, w=v * f * u - p * y * u - v * h * m + c * y * m + p * h * x - c * f * x, _=p * g * u - v * d * u + v * l * m - c * g * m - p * l * x + c * d * x, M=v * d * h - p * g * h - v * l * f + c * g * f + p * l * y - c * d * y, S=i * b + a * w + o * _ + s * M; if (0===S) { var T="THREE.Matrix4: .getInverse() can't invert matrix, determinant is 0" ; if (!0===t) throw new Error(T); return console.warn(T), this.identity() } var E=1 / S; return n[0]=b * E, n[1]=(g * f * s - d * y * s - g * o * m + a * y * m + d * o * x - a * f * x) * E, n[2]=(l * y * s - g * h * s + g * o * u - a * y * u - l * o * x + a * h * x) * E, n[3]=(d * h * s - l * f * s - d * o * u + a * f * u + l * o * m - a * h * m) * E, n[4]=w * E, n[5]=(p * y * s - v * f * s + v * o * m - i * y * m - p * o * x + i * f * x) * E, n[6]=(v * h * s - c * y * s - v * o * u + i * y * u + c * o * x - i * h * x) * E, n[7]=(c * f * s - p * h * s + p * o * u - i * f * u - c * o * m + i * h * m) * E, n[8]=_ * E, n[9]=(v * d * s - p * g * s - v * a * m + i * g * m + p * a * x - i * d * x) * E, n[10]=(c * g * s - v * l * s + v * a * u - i * g * u - c * a * x + i * l * x) * E, n[11]=(p * l * s - c * d * s - p * a * u + i * d * u + c * a * m - i * l * m) * E, n[12]=M * E, n[13]=(p * g * o - v * d * o + v * a * f - i * g * f - p * a * y + i * d * y) * E, n[14]=(v * l * o - c * g * o - v * a * h + i * g * h + c * a * y - i * l * y) * E, n[15]=(c * d * o - p * l * o + p * a * h - i * d * h - c * a * f + i * l * f) * E, this }, scale: function(e) { var t=this.elements, n=e.x, r=e.y, i=e.z; return t[0] *=n, t[4] *=r, t[8] *=i, t[1] *=n, t[5] *=r, t[9] *=i, t[2] *=n, t[6] *=r, t[10] *=i, t[3] *=n, t[7] *=r, t[11] *=i, this }, getMaxScaleOnAxis: function() { var e=this.elements, t=e[0] * e[0] + e[1] * e[1] + e[2] * e[2], n=e[4] * e[4] + e[5] * e[5] + e[6] * e[6], r=e[8] * e[8] + e[9] * e[9] + e[10] * e[10]; return Math.sqrt(Math.max(t, n, r)) }, makeTranslation: function(e, t, n) { return this.set(1, 0, 0, e, 0, 1, 0, t, 0, 0, 1, n, 0, 0, 0, 1), this }, makeRotationX: function(e) { var t=Math.cos(e), n=Math.sin(e); return this.set(1, 0, 0, 0, 0, t, -n, 0, 0, n, t, 0, 0, 0, 0, 1), this }, makeRotationY: function(e) { var t=Math.cos(e), n=Math.sin(e); return this.set(t, 0, n, 0, 0, 1, 0, 0, -n, 0, t, 0, 0, 0, 0, 1), this }, makeRotationZ: function(e) { var t=Math.cos(e), n=Math.sin(e); return this.set(t, -n, 0, 0, n, t, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1), this }, makeRotationAxis: function(e, t) { var n=Math.cos(t), r=Math.sin(t), i=1 - n, a=e.x, o=e.y, s=e.z, c=i * a, l=i * o; return this.set(c * a + n, c * o - r * s, c * s + r * o, 0, c * o + r * s, l * o + n, l * s - r * a, 0, c * s - r * o, l * s + r * a, i * s * s + n, 0, 0, 0, 0, 1), this }, makeScale: function(e, t, n) { return this.set(e, 0, 0, 0, 0, t, 0, 0, 0, 0, n, 0, 0, 0, 0, 1), this }, makeShear: function(e, t, n) { return this.set(1, t, n, 0, e, 1, n, 0, e, t, 1, 0, 0, 0, 0, 1), this }, compose: function(e, t, n) { var r=this.elements, i=t._x, a=t._y, o=t._z, s=t._w, c=i + i, l=a + a, h=o + o, u=i * c, p=i * l, d=i * h, f=a * l, m=a * h, v=o * h, g=s * c, y=s * l, x=s * h, b=n.x, w=n.y, _=n.z; return r[0]=(1 - (f + v)) * b, r[1]=(p + x) * b, r[2]=(d - y) * b, r[3]=0, r[4]=(p - x) * w, r[5]=(1 - (u + v)) * w, r[6]=(m + g) * w, r[7]=0, r[8]=(d + y) * _, r[9]=(m - g) * _, r[10]=(1 - (u + f)) * _, r[11]=0, r[12]=e.x, r[13]=e.y, r[14]=e.z, r[15]=1, this }, decompose: function(e, t, n) { var r=this.elements, i=vl.set(r[0], r[1], r[2]).length(), a=vl.set(r[4], r[5], r[6]).length(), o=vl.set(r[8], r[9], r[10]).length(); this.determinant() < 0 && (i=-i), e.x=r[12], e.y=r[13], e.z=r[14], gl.copy(this); var s=1 / i, c=1 / a, l=1 / o; return gl.elements[0] *=s, gl.elements[1] *=s, gl.elements[2] *=s, gl.elements[4] *=c, gl.elements[5] *=c, gl.elements[6] *=c, gl.elements[8] *=l, gl.elements[9] *=l, gl.elements[10] *=l, t.setFromRotationMatrix(gl), n.x=i, n.y=a, n.z=o, this }, makePerspective: function(e, t, n, r, i, a) { void 0===a && console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs."); var o=this.elements, s=2 * i / (t - e), c=2 * i / (n - r), l=(t + e) / (t - e), h=(n + r) / (n - r), u=-(a + i) / (a - i), p=-2 * a * i / (a - i); return o[0]=s, o[4]=0, o[8]=l, o[12]=0, o[1]=0, o[5]=c, o[9]=h, o[13]=0, o[2]=0, o[6]=0, o[10]=u, o[14]=p, o[3]=0, o[7]=0, o[11]=-1, o[15]=0, this }, makeOrthographic: function(e, t, n, r, i, a) { var o=this.elements, s=1 / (t - e), c=1 / (n - r), l=1 / (a - i), h=(t + e) * s, u=(n + r) * c, p=(a + i) * l; return o[0]=2 * s, o[4]=0, o[8]=0, o[12]=-h, o[1]=0, o[5]=2 * c, o[9]=0, o[13]=-u, o[2]=0, o[6]=0, o[10]=-2 * l, o[14]=-p, o[3]=0, o[7]=0, o[11]=0, o[15]=1, this }, equals: function(e) { for (var t=this.elements, n=e.elements, r=0; r < 16; r++) if (t[r] !==n[r]) return !1; return !0 }, fromArray: function(e, t) { void 0===t && (t=0); for (var n=0; n < 16; n++) this.elements[n]=e[n + t]; return this }, toArray: function(e, t) { void 0===e && (e=[]), void 0===t && (t=0); var n=this.elements; return e[t]=n[0], e[t + 1]=n[1], e[t + 2]=n[2], e[t + 3]=n[3], e[t + 4]=n[4], e[t + 5]=n[5], e[t + 6]=n[6], e[t + 7]=n[7], e[t + 8]=n[8], e[t + 9]=n[9], e[t + 10]=n[10], e[t + 11]=n[11], e[t + 12]=n[12], e[t + 13]=n[13], e[t + 14]=n[14], e[t + 15]=n[15], e } }); var Ml=new h, Sl=new r; u.RotationOrders=["XYZ", "YZX" , "ZXY" , "XZY" , "YXZ" , "ZYX" ], u.DefaultOrder="XYZ" , Object.defineProperties(u.prototype, { x: { get: function() { return this._x }, set: function(e) { this._x=e, this._onChangeCallback() } }, y: { get: function() { return this._y }, set: function(e) { this._y=e, this._onChangeCallback() } }, z: { get: function() { return this._z }, set: function(e) { this._z=e, this._onChangeCallback() } }, order: { get: function() { return this._order }, set: function(e) { this._order=e, this._onChangeCallback() } } }), Object.assign(u.prototype, { isEuler: !0, set: function(e, t, n, r) { return this._x=e, this._y=t, this._z=n, this._order=r || this._order, this._onChangeCallback(), this }, clone: function() { return new this.constructor(this._x, this._y, this._z, this._order) }, copy: function(e) { return this._x=e._x, this._y=e._y, this._z=e._z, this._order=e._order, this._onChangeCallback(), this }, setFromRotationMatrix: function(e, t, n) { var r=ll.clamp, i=e.elements, a=i[0], o=i[4], s=i[8], c=i[1], l=i[5], h=i[9], u=i[2], p=i[6], d=i[10]; return t=t || this._order, "XYZ"===t ? (this._y=Math.asin(r(s, -1, 1)), Math.abs(s) < .9999999 ? (this._x=Math.atan2(-h, d), this._z=Math.atan2(-o, a)) : (this._x=Math.atan2(p, l), this._z=0)) : "YXZ"===t ? (this._x=Math.asin(-r(h, -1, 1)), Math.abs(h) < .9999999 ? (this._y=Math.atan2(s, d), this._z=Math.atan2(c, l)) : (this._y=Math.atan2(-u, a), this._z=0)) : "ZXY"===t ? (this._x=Math.asin(r(p, -1, 1)), Math.abs(p) < .9999999 ? (this._y=Math.atan2(-u, d), this._z=Math.atan2(-o, l)) : (this._y=0, this._z=Math.atan2(c, a))) : "ZYX"===t ? (this._y=Math.asin(-r(u, -1, 1)), Math.abs(u) < .9999999 ? (this._x=Math.atan2(p, d), this._z=Math.atan2(c, a)) : (this._x=0, this._z=Math.atan2(-o, l))) : "YZX"===t ? (this._z=Math.asin(r(c, -1, 1)), Math.abs(c) < .9999999 ? (this._x=Math.atan2(-h, l), this._y=Math.atan2(-u, a)) : (this._x=0, this._y=Math.atan2(s, d))) : "XZY"===t ? (this._z=Math.asin(-r(o, -1, 1)), Math.abs(o) < .9999999 ? (this._x=Math.atan2(p, l), this._y=Math.atan2(s, a)) : (this._x=Math.atan2(-h, d), this._y=0)) : console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: " + t), this._order = t, !1 !== n && this._onChangeCallback(), this
},
setFromQuaternion: function(e, t, n) {
return Ml.makeRotationFromQuaternion(e), this.setFromRotationMatrix(Ml, t, n)
},
setFromVector3: function(e, t) {
return this.set(e.x, e.y, e.z, t || this._order)
},
reorder: function(e) {
return Sl.setFromEuler(this), this.setFromQuaternion(Sl, e)
},
equals: function(e) {
return e._x === this._x && e._y === this._y && e._z === this._z && e._order === this._order
},
fromArray: function(e) {
return this._x = e[0], this._y = e[1], this._z = e[2], void 0 !== e[3] && (this._order = e[3]), this._onChangeCallback(), this
},
toArray: function(e, t) {
return void 0 === e && (e = []), void 0 === t && (t = 0), e[t] = this._x, e[t + 1] = this._y, e[t + 2] = this._z, e[t + 3] = this._order, e
},
toVector3: function(e) {
return e ? e.set(this._x, this._y, this._z) : new i(this._x, this._y, this._z)
},
_onChange: function(e) {
return this._onChangeCallback = e, this
},
_onChangeCallback: function() {}
}), Object.assign(p.prototype, {
set: function(e) {
this.mask = 1 << e | 0
},
enable: function(e) {
this.mask |= 1 << e | 0
},
enableAll: function() {
this.mask = -1
},
toggle: function(e) {
this.mask ^= 1 << e | 0
},
disable: function(e) {
this.mask &= ~(1 << e | 0)
},
disableAll: function() {
this.mask = 0
},
test: function(e) {
return 0 != (this.mask & e.mask)
}
});
var Tl = 0,
El = new i,
Al = new r,
Ll = new h,
Rl = new i,
Pl = new i,
Cl = new i,
Ol = new r,
Dl = new i(1, 0, 0),
Il = new i(0, 1, 0),
Nl = new i(0, 0, 1),
zl = {
type: " added" }, Bl={ type: "removed" }; d.DefaultUp=new i(0, 1, 0), d.DefaultMatrixAutoUpdate=!0, d.prototype=Object.assign(Object.create(t.prototype), { constructor: d, isObject3D: !0, onBeforeRender: function() {}, onAfterRender: function() {}, applyMatrix: function(e) { this.matrixAutoUpdate && this.updateMatrix(), this.matrix.premultiply(e), this.matrix.decompose(this.position, this.quaternion, this.scale) }, applyQuaternion: function(e) { return this.quaternion.premultiply(e), this }, setRotationFromAxisAngle: function(e, t) { this.quaternion.setFromAxisAngle(e, t) }, setRotationFromEuler: function(e) { this.quaternion.setFromEuler(e, !0) }, setRotationFromMatrix: function(e) { this.quaternion.setFromRotationMatrix(e) }, setRotationFromQuaternion: function(e) { this.quaternion.copy(e) }, rotateOnAxis: function(e, t) { return Al.setFromAxisAngle(e, t), this.quaternion.multiply(Al), this }, rotateOnWorldAxis: function(e, t) { return Al.setFromAxisAngle(e, t), this.quaternion.premultiply(Al), this }, rotateX: function(e) { return this.rotateOnAxis(Dl, e) }, rotateY: function(e) { return this.rotateOnAxis(Il, e) }, rotateZ: function(e) { return this.rotateOnAxis(Nl, e) }, translateOnAxis: function(e, t) { return El.copy(e).applyQuaternion(this.quaternion), this.position.add(El.multiplyScalar(t)), this }, translateX: function(e) { return this.translateOnAxis(Dl, e) }, translateY: function(e) { return this.translateOnAxis(Il, e) }, translateZ: function(e) { return this.translateOnAxis(Nl, e) }, localToWorld: function(e) { return e.applyMatrix4(this.matrixWorld) }, worldToLocal: function(e) { return e.applyMatrix4(Ll.getInverse(this.matrixWorld)) }, lookAt: function(e, t, n) { e.isVector3 ? Rl.copy(e) : Rl.set(e, t, n); var r=this.parent; this.updateWorldMatrix(!0, !1), Pl.setFromMatrixPosition(this.matrixWorld), this.isCamera || this.isLight ? Ll.lookAt(Pl, Rl, this.up) : Ll.lookAt(Rl, Pl, this.up), this.quaternion.setFromRotationMatrix(Ll), r && (Ll.extractRotation(r.matrixWorld), Al.setFromRotationMatrix(Ll), this.quaternion.premultiply(Al.inverse())) }, add: function(e) { if (arguments.length> 1) {
for (var t = 0; t < arguments.length; t++) this.add(arguments[t]); return this } return e===this ? (console.error("THREE.Object3D.add: object can't be added as a child of itself.", e), this) : (e && e.isObject3D ? (null !==e.parent && e.parent.remove(e), e.parent=this, this.children.push(e), e.dispatchEvent(zl)) : console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.", e), this) }, remove: function(e) { if (arguments.length> 1) {
for (var t = 0; t < arguments.length; t++) this.remove(arguments[t]); return this } var n=this.children.indexOf(e); return -1 !==n && (e.parent=null, this.children.splice(n, 1), e.dispatchEvent(Bl)), this }, attach: function(e) { return this.updateWorldMatrix(!0, !1), Ll.getInverse(this.matrixWorld), null !==e.parent && (e.parent.updateWorldMatrix(!0, !1), Ll.multiply(e.parent.matrixWorld)), e.applyMatrix(Ll), e.updateWorldMatrix(!1, !1), this.add(e), this }, getObjectById: function(e) { return this.getObjectByProperty("id", e) }, getObjectByName: function(e) { return this.getObjectByProperty("name", e) }, getObjectByProperty: function(e, t) { if (this[e]===t) return this; for (var n=0, r=this.children.length; n < r; n++) { var i=this.children[n], a=i.getObjectByProperty(e, t); if (void 0 !==a) return a } }, getWorldPosition: function(e) { return void 0===e && (console.warn("THREE.Object3D: .getWorldPosition() target is now required"), e=new i), this.updateMatrixWorld(!0), e.setFromMatrixPosition(this.matrixWorld) }, getWorldQuaternion: function(e) { return void 0===e && (console.warn("THREE.Object3D: .getWorldQuaternion() target is now required"), e=new r), this.updateMatrixWorld(!0), this.matrixWorld.decompose(Pl, e, Cl), e }, getWorldScale: function(e) { return void 0===e && (console.warn("THREE.Object3D: .getWorldScale() target is now required"), e=new i), this.updateMatrixWorld(!0), this.matrixWorld.decompose(Pl, Ol, e), e }, getWorldDirection: function(e) { void 0===e && (console.warn("THREE.Object3D: .getWorldDirection() target is now required"), e=new i), this.updateMatrixWorld(!0); var t=this.matrixWorld.elements; return e.set(t[8], t[9], t[10]).normalize() }, raycast: function() {}, traverse: function(e) { e(this); for (var t=this.children, n=0, r=t.length; n < r; n++) t[n].traverse(e) }, traverseVisible: function(e) { if (!1 !==this.visible) { e(this); for (var t=this.children, n=0, r=t.length; n < r; n++) t[n].traverseVisible(e) } }, traverseAncestors: function(e) { var t=this.parent; null !==t && (e(t), t.traverseAncestors(e)) }, updateMatrix: function() { this.matrix.compose(this.position, this.quaternion, this.scale), this.matrixWorldNeedsUpdate=!0 }, updateMatrixWorld: function(e) { this.matrixAutoUpdate && this.updateMatrix(), (this.matrixWorldNeedsUpdate || e) && (null===this.parent ? this.matrixWorld.copy(this.matrix) : this.matrixWorld.multiplyMatrices(this.parent.matrixWorld, this.matrix), this.matrixWorldNeedsUpdate=!1, e=!0); for (var t=this.children, n=0, r=t.length; n < r; n++) t[n].updateMatrixWorld(e) }, updateWorldMatrix: function(e, t) { var n=this.parent; if (!0===e && null !==n && n.updateWorldMatrix(!0, !1), this.matrixAutoUpdate && this.updateMatrix(), null===this.parent ? this.matrixWorld.copy(this.matrix) : this.matrixWorld.multiplyMatrices(this.parent.matrixWorld, this.matrix), !0===t) for (var r=this.children, i=0, a=r.length; i < a; i++) r[i].updateWorldMatrix(!1, !0) }, toJSON: function(e) { function t(t, n) { return void 0===t[n.uuid] && (t[n.uuid]=n.toJSON(e)), n.uuid } function n(e) { var t=[]; for (var n in e) { var r=e[n]; delete r.metadata, t.push(r) } return t } var r=void 0===e || "string"==typeof e, i={}; r && (e={ geometries: {}, materials: {}, textures: {}, images: {}, shapes: {} }, i.metadata={ version: 4.5, type: "Object" , generator: "Object3D.toJSON" }); var a={}; if (a.uuid=this.uuid, a.type=this.type, "" !==this.name && (a.name=this.name), !0===this.castShadow && (a.castShadow=!0), !0===this.receiveShadow && (a.receiveShadow=!0), !1===this.visible && (a.visible=!1), !1===this.frustumCulled && (a.frustumCulled=!1), 0 !==this.renderOrder && (a.renderOrder=this.renderOrder), "{}" !==JSON.stringify(this.userData) && (a.userData=this.userData), a.layers=this.layers.mask, a.matrix=this.matrix.toArray(), !1===this.matrixAutoUpdate && (a.matrixAutoUpdate=!1), this.isInstancedMesh && (a.type="InstancedMesh" , a.count=this.count, a.instanceMatrix=this.instanceMatrix.toJSON()), this.isMesh || this.isLine || this.isPoints) { a.geometry=t(e.geometries, this.geometry); var o=this.geometry.parameters; if (void 0 !==o && void 0 !==o.shapes) { var s=o.shapes; if (Array.isArray(s)) for (var c=0, l=s.length; c < l; c++) { var h=s[c]; t(e.shapes, h) } else t(e.shapes, s) } } if (void 0 !==this.material) if (Array.isArray(this.material)) { for (var u=[], c=0, l=this.material.length; c < l; c++) u.push(t(e.materials, this.material[c])); a.material=u } else a.material=t(e.materials, this.material); if (this.children.length> 0) {
a.children = [];
for (var c = 0; c < this.children.length; c++) a.children.push(this.children[c].toJSON(e).object) } if (r) { var p=n(e.geometries), d=n(e.materials), f=n(e.textures), m=n(e.images), s=n(e.shapes); p.length> 0 && (i.geometries = p), d.length > 0 && (i.materials = d), f.length > 0 && (i.textures = f), m.length > 0 && (i.images = m), s.length > 0 && (i.shapes = s)
}
return i.object = a, i
},
clone: function(e) {
return (new this.constructor).copy(this, e)
},
copy: function(e, t) {
if (void 0 === t && (t = !0), this.name = e.name, this.up.copy(e.up), this.position.copy(e.position), this.quaternion.copy(e.quaternion), this.scale.copy(e.scale), this.matrix.copy(e.matrix), this.matrixWorld.copy(e.matrixWorld), this.matrixAutoUpdate = e.matrixAutoUpdate, this.matrixWorldNeedsUpdate = e.matrixWorldNeedsUpdate, this.layers.mask = e.layers.mask, this.visible = e.visible, this.castShadow = e.castShadow, this.receiveShadow = e.receiveShadow, this.frustumCulled = e.frustumCulled, this.renderOrder = e.renderOrder, this.userData = JSON.parse(JSON.stringify(e.userData)), !0 === t)
for (var n = 0; n < e.children.length; n++) { var r=e.children[n]; this.add(r.clone()) } return this } }), f.prototype=Object.assign(Object.create(d.prototype), { constructor: f, isScene: !0, copy: function(e, t) { return d.prototype.copy.call(this, e, t), null !==e.background && (this.background=e.background.clone()), null !==e.fog && (this.fog=e.fog.clone()), null !==e.overrideMaterial && (this.overrideMaterial=e.overrideMaterial.clone()), this.autoUpdate=e.autoUpdate, this.matrixAutoUpdate=e.matrixAutoUpdate, this }, toJSON: function(e) { var t=d.prototype.toJSON.call(this, e); return null !==this.background && (t.object.background=this.background.toJSON(e)), null !==this.fog && (t.object.fog=this.fog.toJSON()), t }, dispose: function() { this.dispatchEvent({ type: "dispose" }) } }); var Ul=[new i, new i, new i, new i, new i, new i, new i, new i], Fl=new i, Gl=new m, Hl=new i, Vl=new i, jl=new i, kl=new i, Wl=new i, ql=new i, Xl=new i, Yl=new i, Zl=new i, Jl=new i; Object.assign(m.prototype, { isBox3: !0, set: function(e, t) { return this.min.copy(e), this.max.copy(t), this }, setFromArray: function(e) { for (var t=1 / 0, n=1 / 0, r=1 / 0, i=-1 / 0, a=-1 / 0, o=-1 / 0, s=0, c=e.length; s < c; s +=3) { var l=e[s], h=e[s + 1], u=e[s + 2]; l < t && (t=l), h < n && (n=h), u < r && (r=u), l> i && (i = l), h > a && (a = h), u > o && (o = u)
}
return this.min.set(t, n, r), this.max.set(i, a, o), this
},
setFromBufferAttribute: function(e) {
for (var t = 1 / 0, n = 1 / 0, r = 1 / 0, i = -1 / 0, a = -1 / 0, o = -1 / 0, s = 0, c = e.count; s < c; s++) { var l=e.getX(s), h=e.getY(s), u=e.getZ(s); l < t && (t=l), h < n && (n=h), u < r && (r=u), l> i && (i = l), h > a && (a = h), u > o && (o = u)
}
return this.min.set(t, n, r), this.max.set(i, a, o), this
},
setFromPoints: function(e) {
this.makeEmpty();
for (var t = 0, n = e.length; t < n; t++) this.expandByPoint(e[t]); return this }, setFromCenterAndSize: function(e, t) { var n=Fl.copy(t).multiplyScalar(.5); return this.min.copy(e).sub(n), this.max.copy(e).add(n), this }, setFromObject: function(e) { return this.makeEmpty(), this.expandByObject(e) }, clone: function() { return (new this.constructor).copy(this) }, copy: function(e) { return this.min.copy(e.min), this.max.copy(e.max), this }, makeEmpty: function() { return this.min.x=this.min.y=this.min.z=1 / 0, this.max.x=this.max.y=this.max.z=-1 / 0, this }, isEmpty: function() { return this.max.x < this.min.x || this.max.y < this.min.y || this.max.z < this.min.z }, getCenter: function(e) { return void 0===e && (console.warn("THREE.Box3: .getCenter() target is now required"), e=new i), this.isEmpty() ? e.set(0, 0, 0) : e.addVectors(this.min, this.max).multiplyScalar(.5) }, getSize: function(e) { return void 0===e && (console.warn("THREE.Box3: .getSize() target is now required"), e=new i), this.isEmpty() ? e.set(0, 0, 0) : e.subVectors(this.max, this.min) }, expandByPoint: function(e) { return this.min.min(e), this.max.max(e), this }, expandByVector: function(e) { return this.min.sub(e), this.max.add(e), this }, expandByScalar: function(e) { return this.min.addScalar(-e), this.max.addScalar(e), this }, expandByObject: function(e) { e.updateWorldMatrix(!1, !1); var t=e.geometry; void 0 !==t && (null===t.boundingBox && t.computeBoundingBox(), Gl.copy(t.boundingBox), Gl.applyMatrix4(e.matrixWorld), this.expandByPoint(Gl.min), this.expandByPoint(Gl.max)); for (var n=e.children, r=0, i=n.length; r < i; r++) this.expandByObject(n[r]); return this }, containsPoint: function(e) { return !(e.x < this.min.x || e.x> this.max.x || e.y < this.min.y || e.y> this.max.y || e.z < this.min.z || e.z> this.max.z)
},
containsBox: function(e) {
return this.min.x <= e.min.x && e.max.x <=this.max.x && this.min.y <=e.min.y && e.max.y <=this.max.y && this.min.z <=e.min.z && e.max.z <=this.max.z }, getParameter: function(e, t) { return void 0===t && (console.warn("THREE.Box3: .getParameter() target is now required"), t=new i), t.set((e.x - this.min.x) / (this.max.x - this.min.x), (e.y - this.min.y) / (this.max.y - this.min.y), (e.z - this.min.z) / (this.max.z - this.min.z)) }, intersectsBox: function(e) { return !(e.max.x < this.min.x || e.min.x> this.max.x || e.max.y < this.min.y || e.min.y> this.max.y || e.max.z < this.min.z || e.min.z> this.max.z)
},
intersectsSphere: function(e) {
return this.clampPoint(e.center, Fl), Fl.distanceToSquared(e.center) <= e.radius * e.radius }, intersectsPlane: function(e) { var t, n; return e.normal.x> 0 ? (t = e.normal.x * this.min.x, n = e.normal.x * this.max.x) : (t = e.normal.x * this.max.x, n = e.normal.x * this.min.x), e.normal.y > 0 ? (t += e.normal.y * this.min.y, n += e.normal.y * this.max.y) : (t += e.normal.y * this.max.y, n += e.normal.y * this.min.y), e.normal.z > 0 ? (t += e.normal.z * this.min.z, n += e.normal.z * this.max.z) : (t += e.normal.z * this.max.z, n += e.normal.z * this.min.z), t <= -e.constant && n>= -e.constant
},
intersectsTriangle: function(e) {
if (this.isEmpty()) return !1;
this.getCenter(Xl), Yl.subVectors(this.max, Xl), Hl.subVectors(e.a, Xl), Vl.subVectors(e.b, Xl), jl.subVectors(e.c, Xl), kl.subVectors(Vl, Hl), Wl.subVectors(jl, Vl), ql.subVectors(Hl, jl);
var t = [0, -kl.z, kl.y, 0, -Wl.z, Wl.y, 0, -ql.z, ql.y, kl.z, 0, -kl.x, Wl.z, 0, -Wl.x, ql.z, 0, -ql.x, -kl.y, kl.x, 0, -Wl.y, Wl.x, 0, -ql.y, ql.x, 0];
return !!v(t, Hl, Vl, jl, Yl) && (t = [1, 0, 0, 0, 1, 0, 0, 0, 1], !!v(t, Hl, Vl, jl, Yl) && (Zl.crossVectors(kl, Wl), t = [Zl.x, Zl.y, Zl.z], v(t, Hl, Vl, jl, Yl)))
},
clampPoint: function(e, t) {
return void 0 === t && (console.warn("THREE.Box3: .clampPoint() target is now required"), t = new i), t.copy(e).clamp(this.min, this.max)
},
distanceToPoint: function(e) {
return Fl.copy(e).clamp(this.min, this.max).sub(e).length()
},
getBoundingSphere: function(e) {
return void 0 === e && console.error("THREE.Box3: .getBoundingSphere() target is now required"), this.getCenter(e.center), e.radius = .5 * this.getSize(Fl).length(), e
},
intersect: function(e) {
return this.min.max(e.min), this.max.min(e.max), this.isEmpty() && this.makeEmpty(), this
},
union: function(e) {
return this.min.min(e.min), this.max.max(e.max), this
},
applyMatrix4: function(e) {
return this.isEmpty() ? this : (Ul[0].set(this.min.x, this.min.y, this.min.z).applyMatrix4(e), Ul[1].set(this.min.x, this.min.y, this.max.z).applyMatrix4(e), Ul[2].set(this.min.x, this.max.y, this.min.z).applyMatrix4(e), Ul[3].set(this.min.x, this.max.y, this.max.z).applyMatrix4(e), Ul[4].set(this.max.x, this.min.y, this.min.z).applyMatrix4(e), Ul[5].set(this.max.x, this.min.y, this.max.z).applyMatrix4(e), Ul[6].set(this.max.x, this.max.y, this.min.z).applyMatrix4(e), Ul[7].set(this.max.x, this.max.y, this.max.z).applyMatrix4(e), this.setFromPoints(Ul), this)
},
translate: function(e) {
return this.min.add(e), this.max.add(e), this
},
equals: function(e) {
return e.min.equals(this.min) && e.max.equals(this.max)
}
});
var Ql = new m;
Object.assign(g.prototype, {
set: function(e, t) {
return this.center.copy(e), this.radius = t, this
},
setFromPoints: function(e, t) {
var n = this.center;
void 0 !== t ? n.copy(t) : Ql.setFromPoints(e).getCenter(n);
for (var r = 0, i = 0, a = e.length; i < a; i++) r=Math.max(r, n.distanceToSquared(e[i])); return this.radius=Math.sqrt(r), this }, clone: function() { return (new this.constructor).copy(this) }, copy: function(e) { return this.center.copy(e.center), this.radius=e.radius, this }, empty: function() { return this.radius <=0 }, containsPoint: function(e) { return e.distanceToSquared(this.center) <=this.radius * this.radius }, distanceToPoint: function(e) { return e.distanceTo(this.center) - this.radius }, intersectsSphere: function(e) { var t=this.radius + e.radius; return e.center.distanceToSquared(this.center) <=t * t }, intersectsBox: function(e) { return e.intersectsSphere(this) }, intersectsPlane: function(e) { return Math.abs(e.distanceToPoint(this.center)) <=this.radius }, clampPoint: function(e, t) { var n=this.center.distanceToSquared(e); return void 0===t && (console.warn("THREE.Sphere: .clampPoint() target is now required"), t=new i), t.copy(e), n> this.radius * this.radius && (t.sub(this.center).normalize(), t.multiplyScalar(this.radius).add(this.center)), t
},
getBoundingBox: function(e) {
return void 0 === e && (console.warn("THREE.Sphere: .getBoundingBox() target is now required"), e = new m), e.set(this.center, this.center), e.expandByScalar(this.radius), e
},
applyMatrix4: function(e) {
return this.center.applyMatrix4(e), this.radius = this.radius * e.getMaxScaleOnAxis(), this
},
translate: function(e) {
return this.center.add(e), this
},
equals: function(e) {
return e.center.equals(this.center) && e.radius === this.radius
}
});
var Kl = new i,
$l = new i,
eh = new i,
th = new i,
nh = new i,
rh = new i,
ih = new i;
Object.assign(y.prototype, {
set: function(e, t) {
return this.origin.copy(e), this.direction.copy(t), this
},
clone: function() {
return (new this.constructor).copy(this)
},
copy: function(e) {
return this.origin.copy(e.origin), this.direction.copy(e.direction), this
},
at: function(e, t) {
return void 0 === t && (console.warn("THREE.Ray: .at() target is now required"), t = new i), t.copy(this.direction).multiplyScalar(e).add(this.origin)
},
lookAt: function(e) {
return this.direction.copy(e).sub(this.origin).normalize(), this
},
recast: function(e) {
return this.origin.copy(this.at(e, Kl)), this
},
closestPointToPoint: function(e, t) {
void 0 === t && (console.warn("THREE.Ray: .closestPointToPoint() target is now required"), t = new i), t.subVectors(e, this.origin);
var n = t.dot(this.direction);
return n < 0 ? t.copy(this.origin) : t.copy(this.direction).multiplyScalar(n).add(this.origin) }, distanceToPoint: function(e) { return Math.sqrt(this.distanceSqToPoint(e)) }, distanceSqToPoint: function(e) { var t=Kl.subVectors(e, this.origin).dot(this.direction); return t < 0 ? this.origin.distanceToSquared(e) : (Kl.copy(this.direction).multiplyScalar(t).add(this.origin), Kl.distanceToSquared(e)) }, distanceSqToSegment: function(e, t, n, r) { $l.copy(e).add(t).multiplyScalar(.5), eh.copy(t).sub(e).normalize(), th.copy(this.origin).sub($l); var i, a, o, s, c=.5 * e.distanceTo(t), l=-this.direction.dot(eh), h=th.dot(this.direction), u=-th.dot(eh), p=th.lengthSq(), d=Math.abs(1 - l * l); if (d> 0)
if (i = l * u - h, a = l * h - u, s = c * d, i >= 0)
if (a >= -s)
if (a <= s) { var f=1 / d; i *=f, a *=f, o=i * (i + l * a + 2 * h) + a * (l * i + a + 2 * u) + p } else a=c, i=Math.max(0, -(l * a + h)), o=-i * i + a * (a + 2 * u) + p; else a=-c, i=Math.max(0, -(l * a + h)), o=-i * i + a * (a + 2 * u) + p; else a <=-s ? (i=Math.max(0, -(-l * c + h)), a=i> 0 ? -c : Math.min(Math.max(-c, -u), c), o = -i * i + a * (a + 2 * u) + p) : a <= s ? (i=0, a=Math.min(Math.max(-c, -u), c), o=a * (a + 2 * u) + p) : (i=Math.max(0, -(l * c + h)), a=i> 0 ? c : Math.min(Math.max(-c, -u), c), o = -i * i + a * (a + 2 * u) + p);
else a = l > 0 ? -c : c, i = Math.max(0, -(l * a + h)), o = -i * i + a * (a + 2 * u) + p;
return n && n.copy(this.direction).multiplyScalar(i).add(this.origin), r && r.copy(eh).multiplyScalar(a).add($l), o
},
intersectSphere: function(e, t) {
Kl.subVectors(e.center, this.origin);
var n = Kl.dot(this.direction),
r = Kl.dot(Kl) - n * n,
i = e.radius * e.radius;
if (r > i) return null;
var a = Math.sqrt(i - r),
o = n - a,
s = n + a;
return o < 0 && s < 0 ? null : o < 0 ? this.at(s, t) : this.at(o, t) }, intersectsSphere: function(e) { return this.distanceSqToPoint(e.center) <=e.radius * e.radius }, distanceToPlane: function(e) { var t=e.normal.dot(this.direction); if (0===t) return 0===e.distanceToPoint(this.origin) ? 0 : null; var n=-(this.origin.dot(e.normal) + e.constant) / t; return n>= 0 ? n : null
},
intersectPlane: function(e, t) {
var n = this.distanceToPlane(e);
return null === n ? null : this.at(n, t)
},
intersectsPlane: function(e) {
var t = e.distanceToPoint(this.origin);
return 0 === t || e.normal.dot(this.direction) * t < 0 }, intersectBox: function(e, t) { var n, r, i, a, o, s, c=1 / this.direction.x, l=1 / this.direction.y, h=1 / this.direction.z, u=this.origin; return c>= 0 ? (n = (e.min.x - u.x) * c, r = (e.max.x - u.x) * c) : (n = (e.max.x - u.x) * c, r = (e.min.x - u.x) * c), l >= 0 ? (i = (e.min.y - u.y) * l, a = (e.max.y - u.y) * l) : (i = (e.max.y - u.y) * l, a = (e.min.y - u.y) * l), n > a || i > r ? null : ((i > n || n !== n) && (n = i), (a < r || r !==r) && (r=a), h>= 0 ? (o = (e.min.z - u.z) * h, s = (e.max.z - u.z) * h) : (o = (e.max.z - u.z) * h, s = (e.min.z - u.z) * h), n > s || o > r ? null : ((o > n || n !== n) && (n = o), (s < r || r !==r) && (r=s), r < 0 ? null : this.at(n>= 0 ? n : r, t)))
},
intersectsBox: function(e) {
return null !== this.intersectBox(e, Kl)
},
intersectTriangle: function(e, t, n, r, i) {
nh.subVectors(t, e), rh.subVectors(n, e), ih.crossVectors(nh, rh);
var a, o = this.direction.dot(ih);
if (o > 0) {
if (r) return null;
a = 1
} else {
if (!(o < 0)) return null; a=-1, o=-o } th.subVectors(this.origin, e); var s=a * this.direction.dot(rh.crossVectors(th, rh)); if (s < 0) return null; var c=a * this.direction.dot(nh.cross(th)); if (c < 0) return null; if (s + c> o) return null;
var l = -a * th.dot(ih);
return l < 0 ? null : this.at(l / o, i) }, applyMatrix4: function(e) { return this.origin.applyMatrix4(e), this.direction.transformDirection(e), this }, equals: function(e) { return e.origin.equals(this.origin) && e.direction.equals(this.direction) } }); var ah=new i, oh=new i, sh=new a; Object.assign(x.prototype, { isPlane: !0, set: function(e, t) { return this.normal.copy(e), this.constant=t, this }, setComponents: function(e, t, n, r) { return this.normal.set(e, t, n), this.constant=r, this }, setFromNormalAndCoplanarPoint: function(e, t) { return this.normal.copy(e), this.constant=-t.dot(this.normal), this }, setFromCoplanarPoints: function(e, t, n) { var r=ah.subVectors(n, t).cross(oh.subVectors(e, t)).normalize(); return this.setFromNormalAndCoplanarPoint(r, e), this }, clone: function() { return (new this.constructor).copy(this) }, copy: function(e) { return this.normal.copy(e.normal), this.constant=e.constant, this }, normalize: function() { var e=1 / this.normal.length(); return this.normal.multiplyScalar(e), this.constant *=e, this }, negate: function() { return this.constant *=-1, this.normal.negate(), this }, distanceToPoint: function(e) { return this.normal.dot(e) + this.constant }, distanceToSphere: function(e) { return this.distanceToPoint(e.center) - e.radius }, projectPoint: function(e, t) { return void 0===t && (console.warn("THREE.Plane: .projectPoint() target is now required"), t=new i), t.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e) }, intersectLine: function(e, t) { void 0===t && (console.warn("THREE.Plane: .intersectLine() target is now required"), t=new i); var n=e.delta(ah), r=this.normal.dot(n); if (0 !==r) { var a=-(e.start.dot(this.normal) + this.constant) / r; if (!(a < 0 || a> 1)) return t.copy(n).multiplyScalar(a).add(e.start)
} else if (0 === this.distanceToPoint(e.start)) return t.copy(e.start)
},
intersectsLine: function(e) {
var t = this.distanceToPoint(e.start),
n = this.distanceToPoint(e.end);
return t < 0 && n> 0 || n < 0 && t> 0
},
intersectsBox: function(e) {
return e.intersectsPlane(this)
},
intersectsSphere: function(e) {
return e.intersectsPlane(this)
},
coplanarPoint: function(e) {
return void 0 === e && (console.warn("THREE.Plane: .coplanarPoint() target is now required"), e = new i), e.copy(this.normal).multiplyScalar(-this.constant)
},
applyMatrix4: function(e, t) {
var n = t || sh.getNormalMatrix(e),
r = this.coplanarPoint(ah).applyMatrix4(e),
i = this.normal.applyMatrix3(n).normalize();
return this.constant = -r.dot(i), this
},
translate: function(e) {
return this.constant -= e.dot(this.normal), this
},
equals: function(e) {
return e.normal.equals(this.normal) && e.constant === this.constant
}
});
var ch = new i,
lh = new i,
hh = new i,
uh = new i,
ph = new i,
dh = new i,
fh = new i,
mh = new i,
vh = new i,
gh = new i;
Object.assign(b, {
getNormal: function(e, t, n, r) {
void 0 === r && (console.warn("THREE.Triangle: .getNormal() target is now required"), r = new i), r.subVectors(n, t), ch.subVectors(e, t), r.cross(ch);
var a = r.lengthSq();
return a > 0 ? r.multiplyScalar(1 / Math.sqrt(a)) : r.set(0, 0, 0)
},
getBarycoord: function(e, t, n, r, a) {
ch.subVectors(r, t), lh.subVectors(n, t), hh.subVectors(e, t);
var o = ch.dot(ch),
s = ch.dot(lh),
c = ch.dot(hh),
l = lh.dot(lh),
h = lh.dot(hh),
u = o * l - s * s;
if (void 0 === a && (console.warn("THREE.Triangle: .getBarycoord() target is now required"), a = new i), 0 === u) return a.set(-2, -1, -1);
var p = 1 / u,
d = (l * c - s * h) * p,
f = (o * h - s * c) * p;
return a.set(1 - d - f, f, d)
},
containsPoint: function(e, t, n, r) {
return b.getBarycoord(e, t, n, r, uh), uh.x >= 0 && uh.y >= 0 && uh.x + uh.y <= 1 }, getUV: function(e, t, n, r, i, a, o, s) { return this.getBarycoord(e, t, n, r, uh), s.set(0, 0), s.addScaledVector(i, uh.x), s.addScaledVector(a, uh.y), s.addScaledVector(o, uh.z), s }, isFrontFacing: function(e, t, n, r) { return ch.subVectors(n, t), lh.subVectors(e, t), ch.cross(lh).dot(r) < 0 } }), Object.assign(b.prototype, { set: function(e, t, n) { return this.a.copy(e), this.b.copy(t), this.c.copy(n), this }, setFromPointsAndIndices: function(e, t, n, r) { return this.a.copy(e[t]), this.b.copy(e[n]), this.c.copy(e[r]), this }, clone: function() { return (new this.constructor).copy(this) }, copy: function(e) { return this.a.copy(e.a), this.b.copy(e.b), this.c.copy(e.c), this }, getArea: function() { return ch.subVectors(this.c, this.b), lh.subVectors(this.a, this.b), .5 * ch.cross(lh).length() }, getMidpoint: function(e) { return void 0===e && (console.warn("THREE.Triangle: .getMidpoint() target is now required"), e=new i), e.addVectors(this.a, this.b).add(this.c).multiplyScalar(1 / 3) }, getNormal: function(e) { return b.getNormal(this.a, this.b, this.c, e) }, getPlane: function(e) { return void 0===e && (console.warn("THREE.Triangle: .getPlane() target is now required"), e=new x), e.setFromCoplanarPoints(this.a, this.b, this.c) }, getBarycoord: function(e, t) { return b.getBarycoord(e, this.a, this.b, this.c, t) }, getUV: function(e, t, n, r, i) { return b.getUV(e, this.a, this.b, this.c, t, n, r, i) }, containsPoint: function(e) { return b.containsPoint(e, this.a, this.b, this.c) }, isFrontFacing: function(e) { return b.isFrontFacing(this.a, this.b, this.c, e) }, intersectsBox: function(e) { return e.intersectsTriangle(this) }, closestPointToPoint: function(e, t) { void 0===t && (console.warn("THREE.Triangle: .closestPointToPoint() target is now required"), t=new i); var n, r, a=this.a, o=this.b, s=this.c; ph.subVectors(o, a), dh.subVectors(s, a), mh.subVectors(e, a); var c=ph.dot(mh), l=dh.dot(mh); if (c <=0 && l <=0) return t.copy(a); vh.subVectors(e, o); var h=ph.dot(vh), u=dh.dot(vh); if (h>= 0 && u <= h) return t.copy(o); var p=c * u - h * l; if (p <=0 && c>= 0 && h <= 0) return n=c / (c - h), t.copy(a).addScaledVector(ph, n); gh.subVectors(e, s); var d=ph.dot(gh), f=dh.dot(gh); if (f>= 0 && d <= f) return t.copy(s); var m=d * l - c * f; if (m <=0 && l>= 0 && f <= 0) return r=l / (l - f), t.copy(a).addScaledVector(dh, r); var v=h * f - d * u; if (v <=0 && u - h>= 0 && d - f >= 0) return fh.subVectors(s, o), r = (u - h) / (u - h + (d - f)), t.copy(o).addScaledVector(fh, r);
var g = 1 / (v + m + p);
return n = m * g, r = p * g, t.copy(a).addScaledVector(ph, n).addScaledVector(dh, r)
},
equals: function(e) {
return e.a.equals(this.a) && e.b.equals(this.b) && e.c.equals(this.c)
}
});
var yh = {
aliceblue: 15792383,
antiquewhite: 16444375,
aqua: 65535,
aquamarine: 8388564,
azure: 15794175,
beige: 16119260,
bisque: 16770244,
black: 0,
blanchedalmond: 16772045,
blue: 255,
blueviolet: 9055202,
brown: 10824234,
burlywood: 14596231,
cadetblue: 6266528,
chartreuse: 8388352,
chocolate: 13789470,
coral: 16744272,
cornflowerblue: 6591981,
cornsilk: 16775388,
crimson: 14423100,
cyan: 65535,
darkblue: 139,
darkcyan: 35723,
darkgoldenrod: 12092939,
darkgray: 11119017,
darkgreen: 25600,
darkgrey: 11119017,
darkkhaki: 12433259,
darkmagenta: 9109643,
darkolivegreen: 5597999,
darkorange: 16747520,
darkorchid: 10040012,
darkred: 9109504,
darksalmon: 15308410,
darkseagreen: 9419919,
darkslateblue: 4734347,
darkslategray: 3100495,
darkslategrey: 3100495,
darkturquoise: 52945,
darkviolet: 9699539,
deeppink: 16716947,
deepskyblue: 49151,
dimgray: 6908265,
dimgrey: 6908265,
dodgerblue: 2003199,
firebrick: 11674146,
floralwhite: 16775920,
forestgreen: 2263842,
fuchsia: 16711935,
gainsboro: 14474460,
ghostwhite: 16316671,
gold: 16766720,
goldenrod: 14329120,
gray: 8421504,
green: 32768,
greenyellow: 11403055,
grey: 8421504,
honeydew: 15794160,
hotpink: 16738740,
indianred: 13458524,
indigo: 4915330,
ivory: 16777200,
khaki: 15787660,
lavender: 15132410,
lavenderblush: 16773365,
lawngreen: 8190976,
lemonchiffon: 16775885,
lightblue: 11393254,
lightcoral: 15761536,
lightcyan: 14745599,
lightgoldenrodyellow: 16448210,
lightgray: 13882323,
lightgreen: 9498256,
lightgrey: 13882323,
lightpink: 16758465,
lightsalmon: 16752762,
lightseagreen: 2142890,
lightskyblue: 8900346,
lightslategray: 7833753,
lightslategrey: 7833753,
lightsteelblue: 11584734,
lightyellow: 16777184,
lime: 65280,
limegreen: 3329330,
linen: 16445670,
magenta: 16711935,
maroon: 8388608,
mediumaquamarine: 6737322,
mediumblue: 205,
mediumorchid: 12211667,
mediumpurple: 9662683,
mediumseagreen: 3978097,
mediumslateblue: 8087790,
mediumspringgreen: 64154,
mediumturquoise: 4772300,
mediumvioletred: 13047173,
midnightblue: 1644912,
mintcream: 16121850,
mistyrose: 16770273,
moccasin: 16770229,
navajowhite: 16768685,
navy: 128,
oldlace: 16643558,
olive: 8421376,
olivedrab: 7048739,
orange: 16753920,
orangered: 16729344,
orchid: 14315734,
palegoldenrod: 15657130,
palegreen: 10025880,
paleturquoise: 11529966,
palevioletred: 14381203,
papayawhip: 16773077,
peachpuff: 16767673,
peru: 13468991,
pink: 16761035,
plum: 14524637,
powderblue: 11591910,
purple: 8388736,
rebeccapurple: 6697881,
red: 16711680,
rosybrown: 12357519,
royalblue: 4286945,
saddlebrown: 9127187,
salmon: 16416882,
sandybrown: 16032864,
seagreen: 3050327,
seashell: 16774638,
sienna: 10506797,
silver: 12632256,
skyblue: 8900331,
slateblue: 6970061,
slategray: 7372944,
slategrey: 7372944,
snow: 16775930,
springgreen: 65407,
steelblue: 4620980,
tan: 13808780,
teal: 32896,
thistle: 14204888,
tomato: 16737095,
turquoise: 4251856,
violet: 15631086,
wheat: 16113331,
white: 16777215,
whitesmoke: 16119285,
yellow: 16776960,
yellowgreen: 10145074
},
xh = {
h: 0,
s: 0,
l: 0
},
bh = {
h: 0,
s: 0,
l: 0
};
Object.assign(w.prototype, {
isColor: !0,
r: 1,
g: 1,
b: 1,
set: function(e) {
return e && e.isColor ? this.copy(e) : "number" == typeof e ? this.setHex(e) : "string" == typeof e && this.setStyle(e), this
},
setScalar: function(e) {
return this.r = e, this.g = e, this.b = e, this
},
setHex: function(e) {
return e = Math.floor(e), this.r = (e >> 16 & 255) / 255, this.g = (e >> 8 & 255) / 255, this.b = (255 & e) / 255, this
},
setRGB: function(e, t, n) {
return this.r = e, this.g = t, this.b = n, this
},
setHSL: function(e, t, n) {
if (e = ll.euclideanModulo(e, 1), t = ll.clamp(t, 0, 1), n = ll.clamp(n, 0, 1), 0 === t) this.r = this.g = this.b = n;
else {
var r = n <= .5 ? n * (1 + t) : n + t - n * t, i=2 * n - r; this.r=_(i, r, e + 1 / 3), this.g=_(i, r, e), this.b=_(i, r, e - 1 / 3) } return this }, setStyle: function(e) { function t(t) { void 0 !==t && parseFloat(t) < 1 && console.warn("THREE.Color: Alpha component of " + e + " will be ignored.") } var n; if (n=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(e)) { var r, i=n[1], a=n[2]; switch (i) { case "rgb" : case "rgba" : if (r=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a)) return this.r=Math.min(255, parseInt(r[1], 10)) / 255, this.g=Math.min(255, parseInt(r[2], 10)) / 255, this.b=Math.min(255, parseInt(r[3], 10)) / 255, t(r[5]), this; if (r=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a)) return this.r=Math.min(100, parseInt(r[1], 10)) / 100, this.g=Math.min(100, parseInt(r[2], 10)) / 100, this.b=Math.min(100, parseInt(r[3], 10)) / 100, t(r[5]), this; break; case "hsl" : case "hsla" : if (r=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a)) { var o=parseFloat(r[1]) / 360, s=parseInt(r[2], 10) / 100, c=parseInt(r[3], 10) / 100; return t(r[5]), this.setHSL(o, s, c) } } } else if (n=/^\#([A-Fa-f0-9]+)$/.exec(e)) { var l=n[1], h=l.length; if (3===h) return this.r=parseInt(l.charAt(0) + l.charAt(0), 16) / 255, this.g=parseInt(l.charAt(1) + l.charAt(1), 16) / 255, this.b=parseInt(l.charAt(2) + l.charAt(2), 16) / 255, this; if (6===h) return this.r=parseInt(l.charAt(0) + l.charAt(1), 16) / 255, this.g=parseInt(l.charAt(2) + l.charAt(3), 16) / 255, this.b=parseInt(l.charAt(4) + l.charAt(5), 16) / 255, this } return e && e.length> 0 ? this.setColorName(e) : this
},
setColorName: function(e) {
var t = yh[e];
return void 0 !== t ? this.setHex(t) : console.warn("THREE.Color: Unknown color " + e), this
},
clone: function() {
return new this.constructor(this.r, this.g, this.b)
},
copy: function(e) {
return this.r = e.r, this.g = e.g, this.b = e.b, this
},
copyGammaToLinear: function(e, t) {
return void 0 === t && (t = 2), this.r = Math.pow(e.r, t), this.g = Math.pow(e.g, t), this.b = Math.pow(e.b, t), this
},
copyLinearToGamma: function(e, t) {
void 0 === t && (t = 2);
var n = t > 0 ? 1 / t : 1;
return this.r = Math.pow(e.r, n), this.g = Math.pow(e.g, n), this.b = Math.pow(e.b, n), this
},
convertGammaToLinear: function(e) {
return this.copyGammaToLinear(this, e), this
},
convertLinearToGamma: function(e) {
return this.copyLinearToGamma(this, e), this
},
copySRGBToLinear: function(e) {
return this.r = M(e.r), this.g = M(e.g), this.b = M(e.b), this
},
copyLinearToSRGB: function(e) {
return this.r = S(e.r), this.g = S(e.g), this.b = S(e.b), this
},
convertSRGBToLinear: function() {
return this.copySRGBToLinear(this), this
},
convertLinearToSRGB: function() {
return this.copyLinearToSRGB(this), this
},
getHex: function() {
return 255 * this.r << 16 ^ 255 * this.g << 8 ^ 255 * this.b << 0 }, getHexString: function() { return ("000000" + this.getHex().toString(16)).slice(-6) }, getHSL: function(e) { void 0===e && (console.warn("THREE.Color: .getHSL() target is now required"), e={ h: 0, s: 0, l: 0 }); var t, n, r=this.r, i=this.g, a=this.b, o=Math.max(r, i, a), s=Math.min(r, i, a), c=(s + o) / 2; if (s===o) t=0, n=0; else { var l=o - s; switch (n=c <=.5 ? l / (o + s) : l / (2 - o - s), o) { case r: t=(i - a) / l + (i < a ? 6 : 0); break; case i: t=(a - r) / l + 2; break; case a: t=(r - i) / l + 4 } t /=6 } return e.h=t, e.s=n, e.l=c, e }, getStyle: function() { return "rgb(" + (255 * this.r | 0) + "," + (255 * this.g | 0) + "," + (255 * this.b | 0) + ")" }, offsetHSL: function(e, t, n) { return this.getHSL(xh), xh.h +=e, xh.s +=t, xh.l +=n, this.setHSL(xh.h, xh.s, xh.l), this }, add: function(e) { return this.r +=e.r, this.g +=e.g, this.b +=e.b, this }, addColors: function(e, t) { return this.r=e.r + t.r, this.g=e.g + t.g, this.b=e.b + t.b, this }, addScalar: function(e) { return this.r +=e, this.g +=e, this.b +=e, this }, sub: function(e) { return this.r=Math.max(0, this.r - e.r), this.g=Math.max(0, this.g - e.g), this.b=Math.max(0, this.b - e.b), this }, multiply: function(e) { return this.r *=e.r, this.g *=e.g, this.b *=e.b, this }, multiplyScalar: function(e) { return this.r *=e, this.g *=e, this.b *=e, this }, lerp: function(e, t) { return this.r +=(e.r - this.r) * t, this.g +=(e.g - this.g) * t, this.b +=(e.b - this.b) * t, this }, lerpHSL: function(e, t) { this.getHSL(xh), e.getHSL(bh); var n=ll.lerp(xh.h, bh.h, t), r=ll.lerp(xh.s, bh.s, t), i=ll.lerp(xh.l, bh.l, t); return this.setHSL(n, r, i), this }, equals: function(e) { return e.r===this.r && e.g===this.g && e.b===this.b }, fromArray: function(e, t) { return void 0===t && (t=0), this.r=e[t], this.g=e[t + 1], this.b=e[t + 2], this }, toArray: function(e, t) { return void 0===e && (e=[]), void 0===t && (t=0), e[t]=this.r, e[t + 1]=this.g, e[t + 2]=this.b, e }, toJSON: function() { return this.getHex() } }), w.NAMES=yh, Object.assign(T.prototype, { clone: function() { return (new this.constructor).copy(this) }, copy: function(e) { this.a=e.a, this.b=e.b, this.c=e.c, this.normal.copy(e.normal), this.color.copy(e.color), this.materialIndex=e.materialIndex; for (var t=0, n=e.vertexNormals.length; t < n; t++) this.vertexNormals[t]=e.vertexNormals[t].clone(); for (var t=0, n=e.vertexColors.length; t < n; t++) this.vertexColors[t]=e.vertexColors[t].clone(); return this } }); var wh=0; E.prototype=Object.assign(Object.create(t.prototype), { constructor: E, isMaterial: !0, onBeforeCompile: function() {}, setValues: function(e) { if (void 0 !==e) for (var t in e) { var n=e[t]; if (void 0 !==n) if ("shading" !==t) { var r=this[t]; void 0 !==r ? r && r.isColor ? r.set(n) : r && r.isVector3 && n && n.isVector3 ? r.copy(n) : this[t]=n : console.warn("THREE." + this.type + ": '" + t + "' is not a property of this material." ) } else console.warn("THREE." + this.type + ": .shading has been removed. Use the boolean .flatShading instead." ), this.flatShading=1===n; else console.warn("THREE.Material: '" + t + "' parameter is undefined.") } }, toJSON: function(e) { function t(e) { var t=[]; for (var n in e) { var r=e[n]; delete r.metadata, t.push(r) } return t } var n=void 0===e || "string"==typeof e; n && (e={ textures: {}, images: {} }); var r={ metadata: { version: 4.5, type: "Material" , generator: "Material.toJSON" } }; if (r.uuid=this.uuid, r.type=this.type, "" !==this.name && (r.name=this.name), this.color && this.color.isColor && (r.color=this.color.getHex()), void 0 !==this.roughness && (r.roughness=this.roughness), void 0 !==this.metalness && (r.metalness=this.metalness), this.sheen && this.sheen.isColor && (r.sheen=this.sheen.getHex()), this.emissive && this.emissive.isColor && (r.emissive=this.emissive.getHex()), this.emissiveIntensity && 1 !==this.emissiveIntensity && (r.emissiveIntensity=this.emissiveIntensity), this.specular && this.specular.isColor && (r.specular=this.specular.getHex()), void 0 !==this.shininess && (r.shininess=this.shininess), void 0 !==this.clearcoat && (r.clearcoat=this.clearcoat), void 0 !==this.clearcoatRoughness && (r.clearcoatRoughness=this.clearcoatRoughness), this.clearcoatNormalMap && this.clearcoatNormalMap.isTexture && (r.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid, r.clearcoatNormalScale=this.clearcoatNormalScale.toArray()), this.map && this.map.isTexture && (r.map=this.map.toJSON(e).uuid), this.matcap && this.matcap.isTexture && (r.matcap=this.matcap.toJSON(e).uuid), this.alphaMap && this.alphaMap.isTexture && (r.alphaMap=this.alphaMap.toJSON(e).uuid), this.lightMap && this.lightMap.isTexture && (r.lightMap=this.lightMap.toJSON(e).uuid), this.aoMap && this.aoMap.isTexture && (r.aoMap=this.aoMap.toJSON(e).uuid, r.aoMapIntensity=this.aoMapIntensity), this.bumpMap && this.bumpMap.isTexture && (r.bumpMap=this.bumpMap.toJSON(e).uuid, r.bumpScale=this.bumpScale), this.normalMap && this.normalMap.isTexture && (r.normalMap=this.normalMap.toJSON(e).uuid, r.normalMapType=this.normalMapType, r.normalScale=this.normalScale.toArray()), this.displacementMap && this.displacementMap.isTexture && (r.displacementMap=this.displacementMap.toJSON(e).uuid, r.displacementScale=this.displacementScale, r.displacementBias=this.displacementBias), this.roughnessMap && this.roughnessMap.isTexture && (r.roughnessMap=this.roughnessMap.toJSON(e).uuid), this.metalnessMap && this.metalnessMap.isTexture && (r.metalnessMap=this.metalnessMap.toJSON(e).uuid), this.emissiveMap && this.emissiveMap.isTexture && (r.emissiveMap=this.emissiveMap.toJSON(e).uuid), this.specularMap && this.specularMap.isTexture && (r.specularMap=this.specularMap.toJSON(e).uuid), this.envMap && this.envMap.isTexture && (r.envMap=this.envMap.toJSON(e).uuid, r.reflectivity=this.reflectivity, r.refractionRatio=this.refractionRatio, void 0 !==this.combine && (r.combine=this.combine), void 0 !==this.envMapIntensity && (r.envMapIntensity=this.envMapIntensity)), this.gradientMap && this.gradientMap.isTexture && (r.gradientMap=this.gradientMap.toJSON(e).uuid), void 0 !==this.size && (r.size=this.size), void 0 !==this.sizeAttenuation && (r.sizeAttenuation=this.sizeAttenuation), this.blending !==es && (r.blending=this.blending), !0===this.flatShading && (r.flatShading=this.flatShading), this.side !==Xo && (r.side=this.side), this.vertexColors !==Jo && (r.vertexColors=this.vertexColors), this.opacity < 1 && (r.opacity=this.opacity), !0===this.transparent && (r.transparent=this.transparent), r.depthFunc=this.depthFunc, r.depthTest=this.depthTest, r.depthWrite=this.depthWrite, r.stencilWrite=this.stencilWrite, r.stencilWriteMask=this.stencilWriteMask, r.stencilFunc=this.stencilFunc, r.stencilRef=this.stencilRef, r.stencilFuncMask=this.stencilFuncMask, r.stencilFail=this.stencilFail, r.stencilZFail=this.stencilZFail, r.stencilZPass=this.stencilZPass, this.rotation && 0 !==this.rotation && (r.rotation=this.rotation), !0===this.polygonOffset && (r.polygonOffset=!0), 0 !==this.polygonOffsetFactor && (r.polygonOffsetFactor=this.polygonOffsetFactor), 0 !==this.polygonOffsetUnits && (r.polygonOffsetUnits=this.polygonOffsetUnits), this.linewidth && 1 !==this.linewidth && (r.linewidth=this.linewidth), void 0 !==this.dashSize && (r.dashSize=this.dashSize), void 0 !==this.gapSize && (r.gapSize=this.gapSize), void 0 !==this.scale && (r.scale=this.scale), !0===this.dithering && (r.dithering=!0), this.alphaTest> 0 && (r.alphaTest = this.alphaTest), !0 === this.premultipliedAlpha && (r.premultipliedAlpha = this.premultipliedAlpha), !0 === this.wireframe && (r.wireframe = this.wireframe), this.wireframeLinewidth > 1 && (r.wireframeLinewidth = this.wireframeLinewidth), "round" !== this.wireframeLinecap && (r.wireframeLinecap = this.wireframeLinecap), "round" !== this.wireframeLinejoin && (r.wireframeLinejoin = this.wireframeLinejoin), !0 === this.morphTargets && (r.morphTargets = !0), !0 === this.morphNormals && (r.morphNormals = !0), !0 === this.skinning && (r.skinning = !0), !1 === this.visible && (r.visible = !1), !1 === this.toneMapped && (r.toneMapped = !1), "{}" !== JSON.stringify(this.userData) && (r.userData = this.userData), n) {
var i = t(e.textures),
a = t(e.images);
i.length > 0 && (r.textures = i), a.length > 0 && (r.images = a)
}
return r
},
clone: function() {
return (new this.constructor).copy(this)
},
copy: function(e) {
this.name = e.name, this.fog = e.fog, this.blending = e.blending, this.side = e.side, this.flatShading = e.flatShading, this.vertexTangents = e.vertexTangents, this.vertexColors = e.vertexColors, this.opacity = e.opacity, this.transparent = e.transparent, this.blendSrc = e.blendSrc, this.blendDst = e.blendDst, this.blendEquation = e.blendEquation, this.blendSrcAlpha = e.blendSrcAlpha, this.blendDstAlpha = e.blendDstAlpha, this.blendEquationAlpha = e.blendEquationAlpha, this.depthFunc = e.depthFunc, this.depthTest = e.depthTest, this.depthWrite = e.depthWrite, this.stencilWriteMask = e.stencilWriteMask, this.stencilFunc = e.stencilFunc, this.stencilRef = e.stencilRef, this.stencilFuncMask = e.stencilFuncMask, this.stencilFail = e.stencilFail, this.stencilZFail = e.stencilZFail, this.stencilZPass = e.stencilZPass, this.stencilWrite = e.stencilWrite;
var t = e.clippingPlanes,
n = null;
if (null !== t) {
var r = t.length;
n = new Array(r);
for (var i = 0; i !== r; ++i) n[i] = t[i].clone()
}
return this.clippingPlanes = n, this.clipIntersection = e.clipIntersection, this.clipShadows = e.clipShadows, this.shadowSide = e.shadowSide, this.colorWrite = e.colorWrite, this.precision = e.precision, this.polygonOffset = e.polygonOffset, this.polygonOffsetFactor = e.polygonOffsetFactor, this.polygonOffsetUnits = e.polygonOffsetUnits, this.dithering = e.dithering, this.alphaTest = e.alphaTest, this.premultipliedAlpha = e.premultipliedAlpha, this.visible = e.visible, this.toneMapped = e.toneMapped, this.userData = JSON.parse(JSON.stringify(e.userData)), this
},
dispose: function() {
this.dispatchEvent({
type: "dispose"
})
}
}), Object.defineProperty(E.prototype, "needsUpdate", {
set: function(e) {
!0 === e && this.version++
}
}), A.prototype = Object.create(E.prototype), A.prototype.constructor = A, A.prototype.isMeshBasicMaterial = !0, A.prototype.copy = function(e) {
return E.prototype.copy.call(this, e), this.color.copy(e.color), this.map = e.map, this.lightMap = e.lightMap, this.lightMapIntensity = e.lightMapIntensity, this.aoMap = e.aoMap, this.aoMapIntensity = e.aoMapIntensity, this.specularMap = e.specularMap, this.alphaMap = e.alphaMap, this.envMap = e.envMap, this.combine = e.combine, this.reflectivity = e.reflectivity, this.refractionRatio = e.refractionRatio, this.wireframe = e.wireframe, this.wireframeLinewidth = e.wireframeLinewidth, this.wireframeLinecap = e.wireframeLinecap, this.wireframeLinejoin = e.wireframeLinejoin, this.skinning = e.skinning, this.morphTargets = e.morphTargets, this
};
var _h = new i;
Object.defineProperty(L.prototype, "needsUpdate", {
set: function(e) {
!0 === e && this.version++
}
}), Object.assign(L.prototype, {
isBufferAttribute: !0,
onUploadCallback: function() {},
setUsage: function(e) {
return this.usage = e, this
},
copy: function(e) {
return this.name = e.name, this.array = new e.array.constructor(e.array), this.itemSize = e.itemSize, this.count = e.count, this.normalized = e.normalized, this.usage = e.usage, this
},
copyAt: function(e, t, n) {
e *= this.itemSize, n *= t.itemSize;
for (var r = 0, i = this.itemSize; r < i; r++) this.array[e + r]=t.array[n + r]; return this }, copyArray: function(e) { return this.array.set(e), this }, copyColorsArray: function(e) { for (var t=this.array, n=0, r=0, i=e.length; r < i; r++) { var a=e[r]; void 0===a && (console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined", r), a=new w), t[n++]=a.r, t[n++]=a.g, t[n++]=a.b } return this }, copyVector2sArray: function(e) { for (var t=this.array, r=0, i=0, a=e.length; i < a; i++) { var o=e[i]; void 0===o && (console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined", i), o=new n), t[r++]=o.x, t[r++]=o.y } return this }, copyVector3sArray: function(e) { for (var t=this.array, n=0, r=0, a=e.length; r < a; r++) { var o=e[r]; void 0===o && (console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined", r), o=new i), t[n++]=o.x, t[n++]=o.y, t[n++]=o.z } return this }, copyVector4sArray: function(e) { for (var t=this.array, n=0, r=0, i=e.length; r < i; r++) { var a=e[r]; void 0===a && (console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined", r), a=new s), t[n++]=a.x, t[n++]=a.y, t[n++]=a.z, t[n++]=a.w } return this }, applyMatrix3: function(e) { for (var t=0, n=this.count; t < n; t++) _h.x=this.getX(t), _h.y=this.getY(t), _h.z=this.getZ(t), _h.applyMatrix3(e), this.setXYZ(t, _h.x, _h.y, _h.z); return this }, applyMatrix4: function(e) { for (var t=0, n=this.count; t < n; t++) _h.x=this.getX(t), _h.y=this.getY(t), _h.z=this.getZ(t), _h.applyMatrix4(e), this.setXYZ(t, _h.x, _h.y, _h.z); return this }, applyNormalMatrix: function(e) { for (var t=0, n=this.count; t < n; t++) _h.x=this.getX(t), _h.y=this.getY(t), _h.z=this.getZ(t), _h.applyNormalMatrix(e), this.setXYZ(t, _h.x, _h.y, _h.z); return this }, transformDirection: function(e) { for (var t=0, n=this.count; t < n; t++) _h.x=this.getX(t), _h.y=this.getY(t), _h.z=this.getZ(t), _h.transformDirection(e), this.setXYZ(t, _h.x, _h.y, _h.z); return this }, set: function(e, t) { return void 0===t && (t=0), this.array.set(e, t), this }, getX: function(e) { return this.array[e * this.itemSize] }, setX: function(e, t) { return this.array[e * this.itemSize]=t, this }, getY: function(e) { return this.array[e * this.itemSize + 1] }, setY: function(e, t) { return this.array[e * this.itemSize + 1]=t, this }, getZ: function(e) { return this.array[e * this.itemSize + 2] }, setZ: function(e, t) { return this.array[e * this.itemSize + 2]=t, this }, getW: function(e) { return this.array[e * this.itemSize + 3] }, setW: function(e, t) { return this.array[e * this.itemSize + 3]=t, this }, setXY: function(e, t, n) { return e *=this.itemSize, this.array[e + 0]=t, this.array[e + 1]=n, this }, setXYZ: function(e, t, n, r) { return e *=this.itemSize, this.array[e + 0]=t, this.array[e + 1]=n, this.array[e + 2]=r, this }, setXYZW: function(e, t, n, r, i) { return e *=this.itemSize, this.array[e + 0]=t, this.array[e + 1]=n, this.array[e + 2]=r, this.array[e + 3]=i, this }, onUpload: function(e) { return this.onUploadCallback=e, this }, clone: function() { return new this.constructor(this.array, this.itemSize).copy(this) }, toJSON: function() { return { itemSize: this.itemSize, type: this.array.constructor.name, array: Array.prototype.slice.call(this.array), normalized: this.normalized } } }), R.prototype=Object.create(L.prototype), R.prototype.constructor=R, P.prototype=Object.create(L.prototype), P.prototype.constructor=P, C.prototype=Object.create(L.prototype), C.prototype.constructor=C, O.prototype=Object.create(L.prototype), O.prototype.constructor=O, D.prototype=Object.create(L.prototype), D.prototype.constructor=D, I.prototype=Object.create(L.prototype), I.prototype.constructor=I, N.prototype=Object.create(L.prototype), N.prototype.constructor=N, z.prototype=Object.create(L.prototype), z.prototype.constructor=z, B.prototype=Object.create(L.prototype), B.prototype.constructor=B, Object.assign(U.prototype, { computeGroups: function(e) { for (var t, n=[], r=void 0, i=e.faces, a=0; a < i.length; a++) { var o=i[a]; o.materialIndex !==r && (r=o.materialIndex, void 0 !==t && (t.count=3 * a - t.start, n.push(t)), t={ start: 3 * a, materialIndex: r }) } void 0 !==t && (t.count=3 * a - t.start, n.push(t)), this.groups=n }, fromGeometry: function(e) { var t, r=e.faces, i=e.vertices, a=e.faceVertexUvs, o=a[0] && a[0].length> 0,
s = a[1] && a[1].length > 0,
c = e.morphTargets,
l = c.length;
if (l > 0) {
t = [];
for (var h = 0; h < l; h++) t[h]={ name: c[h].name, data: [] }; this.morphTargets.position=t } var u, p=e.morphNormals, d=p.length; if (d> 0) {
u = [];
for (var h = 0; h < d; h++) u[h]={ name: p[h].name, data: [] }; this.morphTargets.normal=u } var f=e.skinIndices, m=e.skinWeights, v=f.length===i.length, g=m.length===i.length; i.length> 0 && 0 === r.length && console.error("THREE.DirectGeometry: Faceless geometries are not supported.");
for (var h = 0; h < r.length; h++) { var y=r[h]; this.vertices.push(i[y.a], i[y.b], i[y.c]); var x=y.vertexNormals; if (3===x.length) this.normals.push(x[0], x[1], x[2]); else { var b=y.normal; this.normals.push(b, b, b) } var w=y.vertexColors; if (3===w.length) this.colors.push(w[0], w[1], w[2]); else { var _=y.color; this.colors.push(_, _, _) } if (!0===o) { var M=a[0][h]; void 0 !==M ? this.uvs.push(M[0], M[1], M[2]) : (console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ", h), this.uvs.push(new n, new n, new n))
}
if (!0 === s) {
var M = a[1][h];
void 0 !== M ? this.uvs2.push(M[0], M[1], M[2]) : (console.warn(" THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ", h), this.uvs2.push(new n, new n, new n))
}
for (var S = 0; S < l; S++) {
var T = c[S].vertices;
t[S].data.push(T[y.a], T[y.b], T[y.c])
}
for (var S = 0; S < d; S++) {
var E = p[S].vertexNormals[h];
u[S].data.push(E.a, E.b, E.c)
}
v && this.skinIndices.push(f[y.a], f[y.b], f[y.c]), g && this.skinWeights.push(m[y.a], m[y.b], m[y.c])
}
return this.computeGroups(e), this.verticesNeedUpdate = e.verticesNeedUpdate, this.normalsNeedUpdate = e.normalsNeedUpdate, this.colorsNeedUpdate = e.colorsNeedUpdate, this.uvsNeedUpdate = e.uvsNeedUpdate, this.groupsNeedUpdate = e.groupsNeedUpdate, null !== e.boundingSphere && (this.boundingSphere = e.boundingSphere.clone()), null !== e.boundingBox && (this.boundingBox = e.boundingBox.clone()), this
}
});
var Mh = 1,
Sh = new h,
Th = new d,
Eh = new i,
Ah = new m,
Lh = new m,
Rh = new i;
G.prototype = Object.assign(Object.create(t.prototype), {
constructor: G,
isBufferGeometry: !0,
getIndex: function() {
return this.index
},
setIndex: function(e) {
Array.isArray(e) ? this.index = new(F(e) > 65535 ? N : D)(e, 1) : this.index = e
},
getAttribute: function(e) {
return this.attributes[e]
},
setAttribute: function(e, t) {
return this.attributes[e] = t, this
},
deleteAttribute: function(e) {
return delete this.attributes[e], this
},
addGroup: function(e, t, n) {
this.groups.push({
start: e,
count: t,
materialIndex: void 0 !== n ? n : 0
})
},
clearGroups: function() {
this.groups = []
},
setDrawRange: function(e, t) {
this.drawRange.start = e, this.drawRange.count = t
},
applyMatrix: function(e) {
var t = this.attributes.position;
void 0 !== t && (e.applyToBufferAttribute(t), t.needsUpdate = !0);
var n = this.attributes.normal;
if (void 0 !== n) {
var r = (new a).getNormalMatrix(e);
n.applyNormalMatrix(r), n.needsUpdate = !0
}
var i = this.attributes.tangent;
return void 0 !== i && (i.transformDirection(e), i.needsUpdate = !0), null !== this.boundingBox && this.computeBoundingBox(), null !== this.boundingSphere && this.computeBoundingSphere(), this
},
rotateX: function(e) {
return Sh.makeRotationX(e), this.applyMatrix(Sh), this
},
rotateY: function(e) {
return Sh.makeRotationY(e), this.applyMatrix(Sh), this
},
rotateZ: function(e) {
return Sh.makeRotationZ(e), this.applyMatrix(Sh), this
},
translate: function(e, t, n) {
return Sh.makeTranslation(e, t, n), this.applyMatrix(Sh), this
},
scale: function(e, t, n) {
return Sh.makeScale(e, t, n), this.applyMatrix(Sh), this
},
lookAt: function(e) {
return Th.lookAt(e), Th.updateMatrix(), this.applyMatrix(Th.matrix), this
},
center: function() {
return this.computeBoundingBox(), this.boundingBox.getCenter(Eh).negate(), this.translate(Eh.x, Eh.y, Eh.z), this
},
setFromObject: function(e) {
var t = e.geometry;
if (e.isPoints || e.isLine) {
var n = new z(3 * t.vertices.length, 3),
r = new z(3 * t.colors.length, 3);
if (this.setAttribute(" position", n.copyVector3sArray(t.vertices)), this.setAttribute("color", r.copyColorsArray(t.colors)), t.lineDistances && t.lineDistances.length===t.vertices.length) { var i=new z(t.lineDistances.length, 1); this.setAttribute("lineDistance", i.copyArray(t.lineDistances)) } null !==t.boundingSphere && (this.boundingSphere=t.boundingSphere.clone()), null !==t.boundingBox && (this.boundingBox=t.boundingBox.clone()) } else e.isMesh && t && t.isGeometry && this.fromGeometry(t); return this }, setFromPoints: function(e) { for (var t=[], n=0, r=e.length; n < r; n++) { var i=e[n]; t.push(i.x, i.y, i.z || 0) } return this.setAttribute("position", new z(t, 3)), this }, updateFromObject: function(e) { var t=e.geometry; if (e.isMesh) { var n=t.__directGeometry; if (!0===t.elementsNeedUpdate && (n=void 0, t.elementsNeedUpdate=!1), void 0===n) return this.fromGeometry(t); n.verticesNeedUpdate=t.verticesNeedUpdate, n.normalsNeedUpdate=t.normalsNeedUpdate, n.colorsNeedUpdate=t.colorsNeedUpdate, n.uvsNeedUpdate=t.uvsNeedUpdate, n.groupsNeedUpdate=t.groupsNeedUpdate, t.verticesNeedUpdate=!1, t.normalsNeedUpdate=!1, t.colorsNeedUpdate=!1, t.uvsNeedUpdate=!1, t.groupsNeedUpdate=!1, t=n } var r; return !0===t.verticesNeedUpdate && (r=this.attributes.position, void 0 !==r && (r.copyVector3sArray(t.vertices), r.needsUpdate=!0), t.verticesNeedUpdate=!1), !0===t.normalsNeedUpdate && (r=this.attributes.normal, void 0 !==r && (r.copyVector3sArray(t.normals), r.needsUpdate=!0), t.normalsNeedUpdate=!1), !0===t.colorsNeedUpdate && (r=this.attributes.color, void 0 !==r && (r.copyColorsArray(t.colors), r.needsUpdate=!0), t.colorsNeedUpdate=!1), t.uvsNeedUpdate && (r=this.attributes.uv, void 0 !==r && (r.copyVector2sArray(t.uvs), r.needsUpdate=!0), t.uvsNeedUpdate=!1), t.lineDistancesNeedUpdate && (r=this.attributes.lineDistance, void 0 !==r && (r.copyArray(t.lineDistances), r.needsUpdate=!0), t.lineDistancesNeedUpdate=!1), t.groupsNeedUpdate && (t.computeGroups(e.geometry), this.groups=t.groups, t.groupsNeedUpdate=!1), this }, fromGeometry: function(e) { return e.__directGeometry=(new U).fromGeometry(e), this.fromDirectGeometry(e.__directGeometry) }, fromDirectGeometry: function(e) { var t=new Float32Array(3 * e.vertices.length); if (this.setAttribute("position", new L(t, 3).copyVector3sArray(e.vertices)), e.normals.length> 0) {
var n = new Float32Array(3 * e.normals.length);
this.setAttribute("normal", new L(n, 3).copyVector3sArray(e.normals))
}
if (e.colors.length > 0) {
var r = new Float32Array(3 * e.colors.length);
this.setAttribute("color", new L(r, 3).copyColorsArray(e.colors))
}
if (e.uvs.length > 0) {
var i = new Float32Array(2 * e.uvs.length);
this.setAttribute("uv", new L(i, 2).copyVector2sArray(e.uvs))
}
if (e.uvs2.length > 0) {
var a = new Float32Array(2 * e.uvs2.length);
this.setAttribute("uv2", new L(a, 2).copyVector2sArray(e.uvs2))
}
this.groups = e.groups;
for (var o in e.morphTargets) {
for (var s = [], c = e.morphTargets[o], l = 0, h = c.length; l < h; l++) { var u=c[l], p=new z(3 * u.data.length, 3); p.name=u.name, s.push(p.copyVector3sArray(u.data)) } this.morphAttributes[o]=s } if (e.skinIndices.length> 0) {
var d = new z(4 * e.skinIndices.length, 4);
this.setAttribute("skinIndex", d.copyVector4sArray(e.skinIndices))
}
if (e.skinWeights.length > 0) {
var f = new z(4 * e.skinWeights.length, 4);
this.setAttribute("skinWeight", f.copyVector4sArray(e.skinWeights))
}
return null !== e.boundingSphere && (this.boundingSphere = e.boundingSphere.clone()), null !== e.boundingBox && (this.boundingBox = e.boundingBox.clone()), this
},
computeBoundingBox: function() {
null === this.boundingBox && (this.boundingBox = new m);
var e = this.attributes.position,
t = this.morphAttributes.position;
if (void 0 !== e) {
if (this.boundingBox.setFromBufferAttribute(e), t)
for (var n = 0, r = t.length; n < r; n++) { var i=t[n]; Ah.setFromBufferAttribute(i), this.morphTargetsRelative ? (Rh.addVectors(this.boundingBox.min, Ah.min), this.boundingBox.expandByPoint(Rh), Rh.addVectors(this.boundingBox.max, Ah.max), this.boundingBox.expandByPoint(Rh)) : (this.boundingBox.expandByPoint(Ah.min), this.boundingBox.expandByPoint(Ah.max)) } } else this.boundingBox.makeEmpty(); (isNaN(this.boundingBox.min.x) || isNaN(this.boundingBox.min.y) || isNaN(this.boundingBox.min.z)) && console.error('THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.', this) }, computeBoundingSphere: function() { null===this.boundingSphere && (this.boundingSphere=new g); var e=this.attributes.position, t=this.morphAttributes.position; if (e) { var n=this.boundingSphere.center; if (Ah.setFromBufferAttribute(e), t) for (var r=0, i=t.length; r < i; r++) { var a=t[r]; Lh.setFromBufferAttribute(a), this.morphTargetsRelative ? (Rh.addVectors(Ah.min, Lh.min), Ah.expandByPoint(Rh), Rh.addVectors(Ah.max, Lh.max), Ah.expandByPoint(Rh)) : (Ah.expandByPoint(Lh.min), Ah.expandByPoint(Lh.max)) } Ah.getCenter(n); for (var o=0, r=0, i=e.count; r < i; r++) Rh.fromBufferAttribute(e, r), o=Math.max(o, n.distanceToSquared(Rh)); if (t) for (var r=0, i=t.length; r < i; r++) for (var a=t[r], s=this.morphTargetsRelative, c=0, l=a.count; c < l; c++) Rh.fromBufferAttribute(a, c), s && (Eh.fromBufferAttribute(e, c), Rh.add(Eh)), o=Math.max(o, n.distanceToSquared(Rh)); this.boundingSphere.radius=Math.sqrt(o), isNaN(this.boundingSphere.radius) && console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.', this) } }, computeFaceNormals: function() {}, computeVertexNormals: function() { var e=this.index, t=this.attributes; if (t.position) { var n=t.position.array; if (void 0===t.normal) this.setAttribute("normal", new L(new Float32Array(n.length), 3)); else for (var r=t.normal.array, a=0, o=r.length; a < o; a++) r[a]=0; var s, c, l, h=t.normal.array, u=new i, p=new i, d=new i, f=new i, m=new i; if (e) for (var v=e.array, a=0, o=e.count; a < o; a +=3) s=3 * v[a + 0], c=3 * v[a + 1], l=3 * v[a + 2], u.fromArray(n, s), p.fromArray(n, c), d.fromArray(n, l), f.subVectors(d, p), m.subVectors(u, p), f.cross(m), h[s] +=f.x, h[s + 1] +=f.y, h[s + 2] +=f.z, h[c] +=f.x, h[c + 1] +=f.y, h[c + 2] +=f.z, h[l] +=f.x, h[l + 1] +=f.y, h[l + 2] +=f.z; else for (var a=0, o=n.length; a < o; a +=9) u.fromArray(n, a), p.fromArray(n, a + 3), d.fromArray(n, a + 6), f.subVectors(d, p), m.subVectors(u, p), f.cross(m), h[a]=f.x, h[a + 1]=f.y, h[a + 2]=f.z, h[a + 3]=f.x, h[a + 4]=f.y, h[a + 5]=f.z, h[a + 6]=f.x, h[a + 7]=f.y, h[a + 8]=f.z; this.normalizeNormals(), t.normal.needsUpdate=!0 } }, merge: function(e, t) { if (!e || !e.isBufferGeometry) return void console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.", e); void 0===t && (t=0, console.warn("THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge.")); var n=this.attributes; for (var r in n) if (void 0 !==e.attributes[r]) for (var i=n[r], a=i.array, o=e.attributes[r], s=o.array, c=o.itemSize * t, l=Math.min(s.length, a.length - c), h=0, u=c; h < l; h++, u++) a[u]=s[h]; return this }, normalizeNormals: function() { for (var e=this.attributes.normal, t=0, n=e.count; t < n; t++) Rh.x=e.getX(t), Rh.y=e.getY(t), Rh.z=e.getZ(t), Rh.normalize(), e.setXYZ(t, Rh.x, Rh.y, Rh.z) }, toNonIndexed: function() { function e(e, t) { for (var n=e.array, r=e.itemSize, i=new n.constructor(t.length * r), a=0, o=0, s=0, c=t.length; s < c; s++) { a=t[s] * r; for (var l=0; l < r; l++) i[o++]=n[a++] } return new L(i, r) } if (null===this.index) return console.warn("THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed."), this; var t=new G, n=this.index.array, r=this.attributes; for (var i in r) { var a=r[i], o=e(a, n); t.setAttribute(i, o) } var s=this.morphAttributes; for (i in s) { for (var c=[], l=s[i], h=0, u=l.length; h < u; h++) { var a=l[h], o=e(a, n); c.push(o) } t.morphAttributes[i]=c } t.morphTargetsRelative=this.morphTargetsRelative; for (var p=this.groups, h=0, d=p.length; h < d; h++) { var f=p[h]; t.addGroup(f.start, f.count, f.materialIndex) } return t }, toJSON: function() { var e={ metadata: { version: 4.5, type: "BufferGeometry" , generator: "BufferGeometry.toJSON" } }; if (e.uuid=this.uuid, e.type=this.type, "" !==this.name && (e.name=this.name), Object.keys(this.userData).length> 0 && (e.userData = this.userData), void 0 !== this.parameters) {
var t = this.parameters;
for (var n in t) void 0 !== t[n] && (e[n] = t[n]);
return e
}
e.data = {
attributes: {}
};
var r = this.index;
null !== r && (e.data.index = {
type: r.array.constructor.name,
array: Array.prototype.slice.call(r.array)
});
var i = this.attributes;
for (var n in i) {
var a = i[n],
o = a.toJSON();
"" !== a.name && (o.name = a.name), e.data.attributes[n] = o
}
var s = {},
c = !1;
for (var n in this.morphAttributes) {
for (var l = this.morphAttributes[n], h = [], u = 0, p = l.length; u < p; u++) { var a=l[u], o=a.toJSON(); "" !==a.name && (o.name=a.name), h.push(o) } h.length> 0 && (s[n] = h, c = !0)
}
c && (e.data.morphAttributes = s, e.data.morphTargetsRelative = this.morphTargetsRelative);
var d = this.groups;
d.length > 0 && (e.data.groups = JSON.parse(JSON.stringify(d)));
var f = this.boundingSphere;
return null !== f && (e.data.boundingSphere = {
center: f.center.toArray(),
radius: f.radius
}), e
},
clone: function() {
return (new G).copy(this)
},
copy: function(e) {
var t, n, r;
this.index = null, this.attributes = {}, this.morphAttributes = {}, this.groups = [], this.boundingBox = null, this.boundingSphere = null, this.name = e.name;
var i = e.index;
null !== i && this.setIndex(i.clone());
var a = e.attributes;
for (t in a) {
var o = a[t];
this.setAttribute(t, o.clone())
}
var s = e.morphAttributes;
for (t in s) {
var c = [],
l = s[t];
for (n = 0, r = l.length; n < r; n++) c.push(l[n].clone()); this.morphAttributes[t]=c } this.morphTargetsRelative=e.morphTargetsRelative; var h=e.groups; for (n=0, r=h.length; n < r; n++) { var u=h[n]; this.addGroup(u.start, u.count, u.materialIndex) } var p=e.boundingBox; null !==p && (this.boundingBox=p.clone()); var d=e.boundingSphere; return null !==d && (this.boundingSphere=d.clone()), this.drawRange.start=e.drawRange.start, this.drawRange.count=e.drawRange.count, this.userData=e.userData, this }, dispose: function() { this.dispatchEvent({ type: "dispose" }) } }); var Ph=new h, Ch=new y, Oh=new g, Dh=new i, Ih=new i, Nh=new i, zh=new i, Bh=new i, Uh=new i, Fh=new i, Gh=new i, Hh=new i, Vh=new n, jh=new n, kh=new n, Wh=new i, qh=new i; H.prototype=Object.assign(Object.create(d.prototype), { constructor: H, isMesh: !0, copy: function(e) { return d.prototype.copy.call(this, e), void 0 !==e.morphTargetInfluences && (this.morphTargetInfluences=e.morphTargetInfluences.slice()), void 0 !==e.morphTargetDictionary && (this.morphTargetDictionary=Object.assign({}, e.morphTargetDictionary)), this }, updateMorphTargets: function() { var e, t, n, r=this.geometry; if (r.isBufferGeometry) { var i=r.morphAttributes, a=Object.keys(i); if (a.length> 0) {
var o = i[a[0]];
if (void 0 !== o)
for (this.morphTargetInfluences = [], this.morphTargetDictionary = {}, e = 0, t = o.length; e < t; e++) n=o[e].name || String(e), this.morphTargetInfluences.push(0), this.morphTargetDictionary[n]=e } } else { var s=r.morphTargets; void 0 !==s && s.length> 0 && console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")
}
},
raycast: function(e, t) {
var r = this.geometry,
i = this.material,
a = this.matrixWorld;
if (void 0 !== i && (null === r.boundingSphere && r.computeBoundingSphere(), Oh.copy(r.boundingSphere), Oh.applyMatrix4(a), !1 !== e.ray.intersectsSphere(Oh) && (Ph.getInverse(a), Ch.copy(e.ray).applyMatrix4(Ph), null === r.boundingBox || !1 !== Ch.intersectsBox(r.boundingBox)))) {
var o;
if (r.isBufferGeometry) {
var s, c, l, h, u, p, d, f, m, v, g, y = r.index,
x = r.attributes.position,
w = r.morphAttributes.position,
_ = r.morphTargetsRelative,
M = r.attributes.uv,
S = r.attributes.uv2,
T = r.groups,
E = r.drawRange;
if (null !== y)
if (Array.isArray(i))
for (h = 0, p = T.length; h < p; h++) for (f=T[h], m=i[f.materialIndex], v=Math.max(f.start, E.start), g=Math.min(f.start + f.count, E.start + E.count), u=v, d=g; u < d; u +=3) s=y.getX(u), c=y.getX(u + 1), l=y.getX(u + 2), (o=j(this, m, e, Ch, x, w, _, M, S, s, c, l)) && (o.faceIndex=Math.floor(u / 3), o.face.materialIndex=f.materialIndex, t.push(o)); else for (v=Math.max(0, E.start), g=Math.min(y.count, E.start + E.count), h=v, p=g; h < p; h +=3) s=y.getX(h), c=y.getX(h + 1), l=y.getX(h + 2), (o=j(this, i, e, Ch, x, w, _, M, S, s, c, l)) && (o.faceIndex=Math.floor(h / 3), t.push(o)); else if (void 0 !==x) if (Array.isArray(i)) for (h=0, p=T.length; h < p; h++) for (f=T[h], m=i[f.materialIndex], v=Math.max(f.start, E.start), g=Math.min(f.start + f.count, E.start + E.count), u=v, d=g; u < d; u +=3) s=u, c=u + 1, l=u + 2, (o=j(this, m, e, Ch, x, w, _, M, S, s, c, l)) && (o.faceIndex=Math.floor(u / 3), o.face.materialIndex=f.materialIndex, t.push(o)); else for (v=Math.max(0, E.start), g=Math.min(x.count, E.start + E.count), h=v, p=g; h < p; h +=3) s=h, c=h + 1, l=h + 2, (o=j(this, i, e, Ch, x, w, _, M, S, s, c, l)) && (o.faceIndex=Math.floor(h / 3), t.push(o)) } else if (r.isGeometry) { var A, L, R, P, C=Array.isArray(i), O=r.vertices, D=r.faces, I=r.faceVertexUvs[0]; I.length> 0 && (P = I);
for (var N = 0, z = D.length; N < z; N++) { var B=D[N], U=C ? i[B.materialIndex] : i; if (void 0 !==U && (A=O[B.a], L=O[B.b], R=O[B.c], o=V(this, U, e, Ch, A, L, R, Wh))) { if (P && P[N]) { var F=P[N]; Vh.copy(F[0]), jh.copy(F[1]), kh.copy(F[2]), o.uv=b.getUV(Wh, A, L, R, Vh, jh, kh, new n) } o.face=B, o.faceIndex=N, t.push(o) } } } } }, clone: function() { return new this.constructor(this.geometry, this.material).copy(this) } }); var Xh=0, Yh=new h, Zh=new d, Jh=new i; k.prototype=Object.assign(Object.create(t.prototype), { constructor: k, isGeometry: !0, applyMatrix: function(e) { for (var t=(new a).getNormalMatrix(e), n=0, r=this.vertices.length; n < r; n++) { this.vertices[n].applyMatrix4(e) } for (var n=0, r=this.faces.length; n < r; n++) { var i=this.faces[n]; i.normal.applyMatrix3(t).normalize(); for (var o=0, s=i.vertexNormals.length; o < s; o++) i.vertexNormals[o].applyMatrix3(t).normalize() } return null !==this.boundingBox && this.computeBoundingBox(), null !==this.boundingSphere && this.computeBoundingSphere(), this.verticesNeedUpdate=!0, this.normalsNeedUpdate=!0, this }, rotateX: function(e) { return Yh.makeRotationX(e), this.applyMatrix(Yh), this }, rotateY: function(e) { return Yh.makeRotationY(e), this.applyMatrix(Yh), this }, rotateZ: function(e) { return Yh.makeRotationZ(e), this.applyMatrix(Yh), this }, translate: function(e, t, n) { return Yh.makeTranslation(e, t, n), this.applyMatrix(Yh), this }, scale: function(e, t, n) { return Yh.makeScale(e, t, n), this.applyMatrix(Yh), this }, lookAt: function(e) { return Zh.lookAt(e), Zh.updateMatrix(), this.applyMatrix(Zh.matrix), this }, fromBufferGeometry: function(e) { function t(e, t, a, o) { var s=void 0===l ? [] : [r.colors[e].clone(), r.colors[t].clone(), r.colors[a].clone()], p=void 0===c ? [] : [(new i).fromArray(c, 3 * e), (new i).fromArray(c, 3 * t), (new i).fromArray(c, 3 * a)], d=new T(e, t, a, p, s, o); r.faces.push(d), void 0 !==h && r.faceVertexUvs[0].push([(new n).fromArray(h, 2 * e), (new n).fromArray(h, 2 * t), (new n).fromArray(h, 2 * a)]), void 0 !==u && r.faceVertexUvs[1].push([(new n).fromArray(u, 2 * e), (new n).fromArray(u, 2 * t), (new n).fromArray(u, 2 * a)]) } var r=this, a=null !==e.index ? e.index.array : void 0, o=e.attributes; if (void 0===o.position) return console.error("THREE.Geometry.fromBufferGeometry(): Position attribute required for conversion."), this; var s=o.position.array, c=void 0 !==o.normal ? o.normal.array : void 0, l=void 0 !==o.color ? o.color.array : void 0, h=void 0 !==o.uv ? o.uv.array : void 0, u=void 0 !==o.uv2 ? o.uv2.array : void 0; void 0 !==u && (this.faceVertexUvs[1]=[]); for (var p=0; p < s.length; p +=3) r.vertices.push((new i).fromArray(s, p)), void 0 !==l && r.colors.push((new w).fromArray(l, p)); var d=e.groups; if (d.length> 0)
for (var p = 0; p < d.length; p++) for (var f=d[p], m=f.start, v=f.count, g=m, y=m + v; g < y; g +=3) void 0 !==a ? t(a[g], a[g + 1], a[g + 2], f.materialIndex) : t(g, g + 1, g + 2, f.materialIndex); else if (void 0 !==a) for (var p=0; p < a.length; p +=3) t(a[p], a[p + 1], a[p + 2]); else for (var p=0; p < s.length / 3; p +=3) t(p, p + 1, p + 2); return this.computeFaceNormals(), null !==e.boundingBox && (this.boundingBox=e.boundingBox.clone()), null !==e.boundingSphere && (this.boundingSphere=e.boundingSphere.clone()), this }, center: function() { return this.computeBoundingBox(), this.boundingBox.getCenter(Jh).negate(), this.translate(Jh.x, Jh.y, Jh.z), this }, normalize: function() { this.computeBoundingSphere(); var e=this.boundingSphere.center, t=this.boundingSphere.radius, n=0===t ? 1 : 1 / t, r=new h; return r.set(n, 0, 0, -n * e.x, 0, n, 0, -n * e.y, 0, 0, n, -n * e.z, 0, 0, 0, 1), this.applyMatrix(r), this }, computeFaceNormals: function() { for (var e=new i, t=new i, n=0, r=this.faces.length; n < r; n++) { var a=this.faces[n], o=this.vertices[a.a], s=this.vertices[a.b], c=this.vertices[a.c]; e.subVectors(c, s), t.subVectors(o, s), e.cross(t), e.normalize(), a.normal.copy(e) } }, computeVertexNormals: function(e) { void 0===e && (e=!0); var t, n, r, a, o, s; for (s=new Array(this.vertices.length), t=0, n=this.vertices.length; t < n; t++) s[t]=new i; if (e) { var c, l, h, u=new i, p=new i; for (r=0, a=this.faces.length; r < a; r++) o=this.faces[r], c=this.vertices[o.a], l=this.vertices[o.b], h=this.vertices[o.c], u.subVectors(h, l), p.subVectors(c, l), u.cross(p), s[o.a].add(u), s[o.b].add(u), s[o.c].add(u) } else for (this.computeFaceNormals(), r=0, a=this.faces.length; r < a; r++) o=this.faces[r], s[o.a].add(o.normal), s[o.b].add(o.normal), s[o.c].add(o.normal); for (t=0, n=this.vertices.length; t < n; t++) s[t].normalize(); for (r=0, a=this.faces.length; r < a; r++) { o=this.faces[r]; var d=o.vertexNormals; 3===d.length ? (d[0].copy(s[o.a]), d[1].copy(s[o.b]), d[2].copy(s[o.c])) : (d[0]=s[o.a].clone(), d[1]=s[o.b].clone(), d[2]=s[o.c].clone()) } this.faces.length> 0 && (this.normalsNeedUpdate = !0)
},
computeFlatVertexNormals: function() {
var e, t, n;
for (this.computeFaceNormals(), e = 0, t = this.faces.length; e < t; e++) { n=this.faces[e]; var r=n.vertexNormals; 3===r.length ? (r[0].copy(n.normal), r[1].copy(n.normal), r[2].copy(n.normal)) : (r[0]=n.normal.clone(), r[1]=n.normal.clone(), r[2]=n.normal.clone()) } this.faces.length> 0 && (this.normalsNeedUpdate = !0)
},
computeMorphNormals: function() {
var e, t, n, r, a;
for (n = 0, r = this.faces.length; n < r; n++) for (a=this.faces[n], a.__originalFaceNormal ? a.__originalFaceNormal.copy(a.normal) : a.__originalFaceNormal=a.normal.clone(), a.__originalVertexNormals || (a.__originalVertexNormals=[]), e=0, t=a.vertexNormals.length; e < t; e++) a.__originalVertexNormals[e] ? a.__originalVertexNormals[e].copy(a.vertexNormals[e]) : a.__originalVertexNormals[e]=a.vertexNormals[e].clone(); var o=new k; for (o.faces=this.faces, e=0, t=this.morphTargets.length; e < t; e++) { if (!this.morphNormals[e]) { this.morphNormals[e]={}, this.morphNormals[e].faceNormals=[], this.morphNormals[e].vertexNormals=[]; var s, c, l=this.morphNormals[e].faceNormals, h=this.morphNormals[e].vertexNormals; for (n=0, r=this.faces.length; n < r; n++) s=new i, c={ a: new i, b: new i, c: new i }, l.push(s), h.push(c) } var u=this.morphNormals[e]; o.vertices=this.morphTargets[e].vertices, o.computeFaceNormals(), o.computeVertexNormals(); var s, c; for (n=0, r=this.faces.length; n < r; n++) a=this.faces[n], s=u.faceNormals[n], c=u.vertexNormals[n], s.copy(a.normal), c.a.copy(a.vertexNormals[0]), c.b.copy(a.vertexNormals[1]), c.c.copy(a.vertexNormals[2]) } for (n=0, r=this.faces.length; n < r; n++) a=this.faces[n], a.normal=a.__originalFaceNormal, a.vertexNormals=a.__originalVertexNormals }, computeBoundingBox: function() { null===this.boundingBox && (this.boundingBox=new m), this.boundingBox.setFromPoints(this.vertices) }, computeBoundingSphere: function() { null===this.boundingSphere && (this.boundingSphere=new g), this.boundingSphere.setFromPoints(this.vertices) }, merge: function(e, t, n) { if (!e || !e.isGeometry) return void console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.", e); var r, i=this.vertices.length, o=this.vertices, s=e.vertices, c=this.faces, l=e.faces, h=this.colors, u=e.colors; void 0===n && (n=0), void 0 !==t && (r=(new a).getNormalMatrix(t)); for (var p=0, d=s.length; p < d; p++) { var f=s[p], m=f.clone(); void 0 !==t && m.applyMatrix4(t), o.push(m) } for (var p=0, d=u.length; p < d; p++) h.push(u[p].clone()); for (p=0, d=l.length; p < d; p++) { var v, g, y, x=l[p], b=x.vertexNormals, w=x.vertexColors; v=new T(x.a + i, x.b + i, x.c + i), v.normal.copy(x.normal), void 0 !==r && v.normal.applyMatrix3(r).normalize(); for (var _=0, M=b.length; _ < M; _++) g=b[_].clone(), void 0 !==r && g.applyMatrix3(r).normalize(), v.vertexNormals.push(g); v.color.copy(x.color); for (var _=0, M=w.length; _ < M; _++) y=w[_], v.vertexColors.push(y.clone()); v.materialIndex=x.materialIndex + n, c.push(v) } for (var p=0, d=e.faceVertexUvs.length; p < d; p++) { var S=e.faceVertexUvs[p]; void 0===this.faceVertexUvs[p] && (this.faceVertexUvs[p]=[]); for (var _=0, M=S.length; _ < M; _++) { for (var E=S[_], A=[], L=0, R=E.length; L < R; L++) A.push(E[L].clone()); this.faceVertexUvs[p].push(A) } } }, mergeMesh: function(e) { if (!e || !e.isMesh) return void console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.", e); e.matrixAutoUpdate && e.updateMatrix(), this.merge(e.geometry, e.matrix) }, mergeVertices: function() { var e, t, n, r, i, a, o, s, c={}, l=[], h=[], u=Math.pow(10, 4); for (n=0, r=this.vertices.length; n < r; n++) e=this.vertices[n], t=Math.round(e.x * u) + "_" + Math.round(e.y * u) + "_" + Math.round(e.z * u), void 0===c[t] ? (c[t]=n, l.push(this.vertices[n]), h[n]=l.length - 1) : h[n]=h[c[t]]; var p=[]; for (n=0, r=this.faces.length; n < r; n++) { i=this.faces[n], i.a=h[i.a], i.b=h[i.b], i.c=h[i.c], a=[i.a, i.b, i.c]; for (var d=0; d < 3; d++) if (a[d]===a[(d + 1) % 3]) { p.push(n); break } } for (n=p.length - 1; n>= 0; n--) {
var f = p[n];
for (this.faces.splice(f, 1), o = 0, s = this.faceVertexUvs.length; o < s; o++) this.faceVertexUvs[o].splice(f, 1) } var m=this.vertices.length - l.length; return this.vertices=l, m }, setFromPoints: function(e) { this.vertices=[]; for (var t=0, n=e.length; t < n; t++) { var r=e[t]; this.vertices.push(new i(r.x, r.y, r.z || 0)) } return this }, sortFacesByMaterialIndex: function() { function e(e, t) { return e.materialIndex - t.materialIndex } for (var t=this.faces, n=t.length, r=0; r < n; r++) t[r]._id=r; t.sort(e); var i, a, o=this.faceVertexUvs[0], s=this.faceVertexUvs[1]; o && o.length===n && (i=[]), s && s.length===n && (a=[]); for (var r=0; r < n; r++) { var c=t[r]._id; i && i.push(o[c]), a && a.push(s[c]) } i && (this.faceVertexUvs[0]=i), a && (this.faceVertexUvs[1]=a) }, toJSON: function() { function e(e, t, n) { return n ? e | 1 << t : e & ~(1 << t) } function t(e) { var t=e.x.toString() + e.y.toString() + e.z.toString(); return void 0 !==p[t] ? p[t] : (p[t]=u.length / 3, u.push(e.x, e.y, e.z), p[t]) } function n(e) { var t=e.r.toString() + e.g.toString() + e.b.toString(); return void 0 !==f[t] ? f[t] : (f[t]=d.length, d.push(e.getHex()), f[t]) } function r(e) { var t=e.x.toString() + e.y.toString(); return void 0 !==v[t] ? v[t] : (v[t]=m.length / 2, m.push(e.x, e.y), v[t]) } var i={ metadata: { version: 4.5, type: "Geometry" , generator: "Geometry.toJSON" } }; if (i.uuid=this.uuid, i.type=this.type, "" !==this.name && (i.name=this.name), void 0 !==this.parameters) { var a=this.parameters; for (var o in a) void 0 !==a[o] && (i[o]=a[o]); return i } for (var s=[], c=0; c < this.vertices.length; c++) { var l=this.vertices[c]; s.push(l.x, l.y, l.z) } for (var h=[], u=[], p={}, d=[], f={}, m=[], v={}, c=0; c < this.faces.length; c++) { var g=this.faces[c], y=void 0 !==this.faceVertexUvs[0][c], x=g.normal.length()> 0,
b = g.vertexNormals.length > 0,
w = 1 !== g.color.r || 1 !== g.color.g || 1 !== g.color.b,
_ = g.vertexColors.length > 0,
M = 0;
if (M = e(M, 0, 0), M = e(M, 1, !0), M = e(M, 2, !1), M = e(M, 3, y), M = e(M, 4, x), M = e(M, 5, b), M = e(M, 6, w), M = e(M, 7, _), h.push(M), h.push(g.a, g.b, g.c), h.push(g.materialIndex), y) {
var S = this.faceVertexUvs[0][c];
h.push(r(S[0]), r(S[1]), r(S[2]))
}
if (x && h.push(t(g.normal)), b) {
var T = g.vertexNormals;
h.push(t(T[0]), t(T[1]), t(T[2]))
}
if (w && h.push(n(g.color)), _) {
var E = g.vertexColors;
h.push(n(E[0]), n(E[1]), n(E[2]))
}
}
return i.data = {}, i.data.vertices = s, i.data.normals = u, d.length > 0 && (i.data.colors = d), m.length > 0 && (i.data.uvs = [m]), i.data.faces = h, i
},
clone: function() {
return (new k).copy(this)
},
copy: function(e) {
var t, n, r, i, a, o;
this.vertices = [], this.colors = [], this.faces = [], this.faceVertexUvs = [
[]
], this.morphTargets = [], this.morphNormals = [], this.skinWeights = [], this.skinIndices = [], this.lineDistances = [], this.boundingBox = null, this.boundingSphere = null, this.name = e.name;
var s = e.vertices;
for (t = 0, n = s.length; t < n; t++) this.vertices.push(s[t].clone()); var c=e.colors; for (t=0, n=c.length; t < n; t++) this.colors.push(c[t].clone()); var l=e.faces; for (t=0, n=l.length; t < n; t++) this.faces.push(l[t].clone()); for (t=0, n=e.faceVertexUvs.length; t < n; t++) { var h=e.faceVertexUvs[t]; for (void 0===this.faceVertexUvs[t] && (this.faceVertexUvs[t]=[]), r=0, i=h.length; r < i; r++) { var u=h[r], p=[]; for (a=0, o=u.length; a < o; a++) { var d=u[a]; p.push(d.clone()) } this.faceVertexUvs[t].push(p) } } var f=e.morphTargets; for (t=0, n=f.length; t < n; t++) { var m={}; if (m.name=f[t].name, void 0 !==f[t].vertices) for (m.vertices=[], r=0, i=f[t].vertices.length; r < i; r++) m.vertices.push(f[t].vertices[r].clone()); if (void 0 !==f[t].normals) for (m.normals=[], r=0, i=f[t].normals.length; r < i; r++) m.normals.push(f[t].normals[r].clone()); this.morphTargets.push(m) } var v=e.morphNormals; for (t=0, n=v.length; t < n; t++) { var g={}; if (void 0 !==v[t].vertexNormals) for (g.vertexNormals=[], r=0, i=v[t].vertexNormals.length; r < i; r++) { var y=v[t].vertexNormals[r], x={}; x.a=y.a.clone(), x.b=y.b.clone(), x.c=y.c.clone(), g.vertexNormals.push(x) } if (void 0 !==v[t].faceNormals) for (g.faceNormals=[], r=0, i=v[t].faceNormals.length; r < i; r++) g.faceNormals.push(v[t].faceNormals[r].clone()); this.morphNormals.push(g) } var b=e.skinWeights; for (t=0, n=b.length; t < n; t++) this.skinWeights.push(b[t].clone()); var w=e.skinIndices; for (t=0, n=w.length; t < n; t++) this.skinIndices.push(w[t].clone()); var _=e.lineDistances; for (t=0, n=_.length; t < n; t++) this.lineDistances.push(_[t]); var M=e.boundingBox; null !==M && (this.boundingBox=M.clone()); var S=e.boundingSphere; return null !==S && (this.boundingSphere=S.clone()), this.elementsNeedUpdate=e.elementsNeedUpdate, this.verticesNeedUpdate=e.verticesNeedUpdate, this.uvsNeedUpdate=e.uvsNeedUpdate, this.normalsNeedUpdate=e.normalsNeedUpdate, this.colorsNeedUpdate=e.colorsNeedUpdate, this.lineDistancesNeedUpdate=e.lineDistancesNeedUpdate, this.groupsNeedUpdate=e.groupsNeedUpdate, this }, dispose: function() { this.dispatchEvent({ type: "dispose" }) } }); var Qh=function(e) { function t(t, n, r, i, a, o) { e.call(this), this.type="BoxGeometry" , this.parameters={ width: t, height: n, depth: r, widthSegments: i, heightSegments: a, depthSegments: o }, this.fromBufferGeometry(new Kh(t, n, r, i, a, o)), this.mergeVertices() } return e && (t.__proto__=e), t.prototype=Object.create(e && e.prototype), t.prototype.constructor=t, t }(k), Kh=function(e) { function t(t, n, r, a, o, s) { function c(e, t, n, r, a, o, s, c, v, g, y) { var x, b, w=o / v, _=s / g, M=o / 2, S=s / 2, T=c / 2, E=v + 1, A=g + 1, L=0, R=0, P=new i; for (b=0; b < A; b++) { var C=b * _ - S; for (x=0; x < E; x++) { var O=x * w - M; P[e]=O * r, P[t]=C * a, P[n]=T, u.push(P.x, P.y, P.z), P[e]=0, P[t]=0, P[n]=c> 0 ? 1 : -1, p.push(P.x, P.y, P.z), d.push(x / v), d.push(1 - b / g), L += 1
}
}
for (b = 0; b < g; b++) for (x=0; x < v; x++) { var D=f + x + E * b, I=f + x + E * (b + 1), N=f + (x + 1) + E * (b + 1), z=f + (x + 1) + E * b; h.push(D, I, z), h.push(I, N, z), R +=6 } l.addGroup(m, R, y), m +=R, f +=L } e.call(this), this.type="BoxBufferGeometry" , this.parameters={ width: t, height: n, depth: r, widthSegments: a, heightSegments: o, depthSegments: s }; var l=this; t=t || 1, n=n || 1, r=r || 1, a=Math.floor(a) || 1, o=Math.floor(o) || 1, s=Math.floor(s) || 1; var h=[], u=[], p=[], d=[], f=0, m=0; c("z", "y" , "x" , -1, -1, r, n, t, s, o, 0), c("z", "y" , "x" , 1, -1, r, n, -t, s, o, 1), c("x", "z" , "y" , 1, 1, t, r, n, a, s, 2), c("x", "z" , "y" , 1, -1, t, r, -n, a, s, 3), c("x", "y" , "z" , 1, -1, t, n, r, a, o, 4), c("x", "y" , "z" , -1, -1, t, n, -r, a, o, 5), this.setIndex(h), this.setAttribute("position", new z(u, 3)), this.setAttribute("normal", new z(p, 3)), this.setAttribute("uv", new z(d, 2)) } return e && (t.__proto__=e), t.prototype=Object.create(e && e.prototype), t.prototype.constructor=t, t }(G), $h={ clone: W, merge: q }, eu="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}" , tu="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}" ; X.prototype=Object.create(E.prototype), X.prototype.constructor=X, X.prototype.isShaderMaterial=!0, X.prototype.copy=function(e) { return E.prototype.copy.call(this, e), this.fragmentShader=e.fragmentShader, this.vertexShader=e.vertexShader, this.uniforms=W(e.uniforms), this.defines=Object.assign({}, e.defines), this.wireframe=e.wireframe, this.wireframeLinewidth=e.wireframeLinewidth, this.lights=e.lights, this.clipping=e.clipping, this.skinning=e.skinning, this.morphTargets=e.morphTargets, this.morphNormals=e.morphNormals, this.extensions=e.extensions, this }, X.prototype.toJSON=function(e) { var t=E.prototype.toJSON.call(this, e); t.uniforms={}; for (var n in this.uniforms) { var r=this.uniforms[n], i=r.value; i && i.isTexture ? t.uniforms[n]={ type: "t" , value: i.toJSON(e).uuid } : i && i.isColor ? t.uniforms[n]={ type: "c" , value: i.getHex() } : i && i.isVector2 ? t.uniforms[n]={ type: "v2" , value: i.toArray() } : i && i.isVector3 ? t.uniforms[n]={ type: "v3" , value: i.toArray() } : i && i.isVector4 ? t.uniforms[n]={ type: "v4" , value: i.toArray() } : i && i.isMatrix3 ? t.uniforms[n]={ type: "m3" , value: i.toArray() } : i && i.isMatrix4 ? t.uniforms[n]={ type: "m4" , value: i.toArray() } : t.uniforms[n]={ value: i } } Object.keys(this.defines).length> 0 && (t.defines = this.defines), t.vertexShader = this.vertexShader, t.fragmentShader = this.fragmentShader;
var a = {};
for (var o in this.extensions) !0 === this.extensions[o] && (a[o] = !0);
return Object.keys(a).length > 0 && (t.extensions = a), t
}, Y.prototype = Object.assign(Object.create(d.prototype), {
constructor: Y,
isCamera: !0,
copy: function(e, t) {
return d.prototype.copy.call(this, e, t), this.matrixWorldInverse.copy(e.matrixWorldInverse), this.projectionMatrix.copy(e.projectionMatrix), this.projectionMatrixInverse.copy(e.projectionMatrixInverse), this
},
getWorldDirection: function(e) {
void 0 === e && (console.warn("THREE.Camera: .getWorldDirection() target is now required"), e = new i), this.updateMatrixWorld(!0);
var t = this.matrixWorld.elements;
return e.set(-t[8], -t[9], -t[10]).normalize()
},
updateMatrixWorld: function(e) {
d.prototype.updateMatrixWorld.call(this, e), this.matrixWorldInverse.getInverse(this.matrixWorld)
},
clone: function() {
return (new this.constructor).copy(this)
}
}), Z.prototype = Object.assign(Object.create(Y.prototype), {
constructor: Z,
isPerspectiveCamera: !0,
copy: function(e, t) {
return Y.prototype.copy.call(this, e, t), this.fov = e.fov, this.zoom = e.zoom, this.near = e.near, this.far = e.far, this.focus = e.focus, this.aspect = e.aspect, this.view = null === e.view ? null : Object.assign({}, e.view), this.filmGauge = e.filmGauge, this.filmOffset = e.filmOffset, this
},
setFocalLength: function(e) {
var t = .5 * this.getFilmHeight() / e;
this.fov = 2 * ll.RAD2DEG * Math.atan(t), this.updateProjectionMatrix()
},
getFocalLength: function() {
var e = Math.tan(.5 * ll.DEG2RAD * this.fov);
return .5 * this.getFilmHeight() / e
},
getEffectiveFOV: function() {
return 2 * ll.RAD2DEG * Math.atan(Math.tan(.5 * ll.DEG2RAD * this.fov) / this.zoom)
},
getFilmWidth: function() {
return this.filmGauge * Math.min(this.aspect, 1)
},
getFilmHeight: function() {
return this.filmGauge / Math.max(this.aspect, 1)
},
setViewOffset: function(e, t, n, r, i, a) {
this.aspect = e / t, null === this.view && (this.view = {
enabled: !0,
fullWidth: 1,
fullHeight: 1,
offsetX: 0,
offsetY: 0,
width: 1,
height: 1
}), this.view.enabled = !0, this.view.fullWidth = e, this.view.fullHeight = t, this.view.offsetX = n, this.view.offsetY = r, this.view.width = i, this.view.height = a, this.updateProjectionMatrix()
},
clearViewOffset: function() {
null !== this.view && (this.view.enabled = !1), this.updateProjectionMatrix()
},
updateProjectionMatrix: function() {
var e = this.near,
t = e * Math.tan(.5 * ll.DEG2RAD * this.fov) / this.zoom,
n = 2 * t,
r = this.aspect * n,
i = -.5 * r,
a = this.view;
if (null !== this.view && this.view.enabled) {
var o = a.fullWidth,
s = a.fullHeight;
i += a.offsetX * r / o, t -= a.offsetY * n / s, r *= a.width / o, n *= a.height / s
}
var c = this.filmOffset;
0 !== c && (i += e * c / this.getFilmWidth()), this.projectionMatrix.makePerspective(i, i + r, t, t - n, e, this.far), this.projectionMatrixInverse.getInverse(this.projectionMatrix)
},
toJSON: function(e) {
var t = d.prototype.toJSON.call(this, e);
return t.object.fov = this.fov, t.object.zoom = this.zoom, t.object.near = this.near, t.object.far = this.far, t.object.focus = this.focus, t.object.aspect = this.aspect, null !== this.view && (t.object.view = Object.assign({}, this.view)), t.object.filmGauge = this.filmGauge, t.object.filmOffset = this.filmOffset, t
}
});
var nu = 90,
ru = 1;
J.prototype = Object.create(d.prototype), J.prototype.constructor = J, Q.prototype = Object.create(c.prototype), Q.prototype.constructor = Q, Q.prototype.isWebGLRenderTargetCube = !0, Q.prototype.fromEquirectangularTexture = function(e, t) {
this.texture.type = t.type, this.texture.format = t.format, this.texture.encoding = t.encoding;
var n = new f,
r = {
uniforms: {
tEquirect: {
value: null
}
},
vertexShader: ["varying vec3 vWorldDirection;", "vec3 transformDirection( in vec3 dir, in mat4 matrix ) {", "\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );", "}", "void main() {", "\tvWorldDirection = transformDirection( position, modelMatrix );", "\t#include ", "\t#include ", "}"].join("\n"),
fragmentShader: ["uniform sampler2D tEquirect;", "varying vec3 vWorldDirection;", "#define RECIPROCAL_PI 0.31830988618", "#define RECIPROCAL_PI2 0.15915494", "void main() {", "\tvec3 direction = normalize( vWorldDirection );", "\tvec2 sampleUV;", "\tsampleUV.y = asin( clamp( direction.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;", "\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;", "\tgl_FragColor = texture2D( tEquirect, sampleUV );", "}"].join("\n")
},
i = new X({
type: "CubemapFromEquirect",
uniforms: W(r.uniforms),
vertexShader: r.vertexShader,
fragmentShader: r.fragmentShader,
side: Yo,
blending: $o
});
i.uniforms.tEquirect.value = t;
var a = new H(new Kh(5, 5, 5), i);
n.add(a);
var o = new J(1, 10, 1);
return o.renderTarget = this, o.renderTarget.texture.name = "CubeCameraTexture", o.update(e, n), a.geometry.dispose(), a.material.dispose(), this
}, K.prototype = Object.create(o.prototype), K.prototype.constructor = K, K.prototype.isDataTexture = !0;
var iu = new g,
au = new i;
Object.assign($.prototype, {
set: function(e, t, n, r, i, a) {
var o = this.planes;
return o[0].copy(e), o[1].copy(t), o[2].copy(n), o[3].copy(r), o[4].copy(i), o[5].copy(a), this
},
clone: function() {
return (new this.constructor).copy(this)
},
copy: function(e) {
for (var t = this.planes, n = 0; n < 6; n++) t[n].copy(e.planes[n]); return this }, setFromMatrix: function(e) { var t=this.planes, n=e.elements, r=n[0], i=n[1], a=n[2], o=n[3], s=n[4], c=n[5], l=n[6], h=n[7], u=n[8], p=n[9], d=n[10], f=n[11], m=n[12], v=n[13], g=n[14], y=n[15]; return t[0].setComponents(o - r, h - s, f - u, y - m).normalize(), t[1].setComponents(o + r, h + s, f + u, y + m).normalize(), t[2].setComponents(o + i, h + c, f + p, y + v).normalize(), t[3].setComponents(o - i, h - c, f - p, y - v).normalize(), t[4].setComponents(o - a, h - l, f - d, y - g).normalize(), t[5].setComponents(o + a, h + l, f + d, y + g).normalize(), this }, intersectsObject: function(e) { var t=e.geometry; return null===t.boundingSphere && t.computeBoundingSphere(), iu.copy(t.boundingSphere).applyMatrix4(e.matrixWorld), this.intersectsSphere(iu) }, intersectsSprite: function(e) { return iu.center.set(0, 0, 0), iu.radius=.7071067811865476, iu.applyMatrix4(e.matrixWorld), this.intersectsSphere(iu) }, intersectsSphere: function(e) { for (var t=this.planes, n=e.center, r=-e.radius, i=0; i < 6; i++) { if (t[i].distanceToPoint(n) < r) return !1 } return !0 }, intersectsBox: function(e) { for (var t=this.planes, n=0; n < 6; n++) { var r=t[n]; if (au.x=r.normal.x> 0 ? e.max.x : e.min.x, au.y = r.normal.y > 0 ? e.max.y : e.min.y, au.z = r.normal.z > 0 ? e.max.z : e.min.z, r.distanceToPoint(au) < 0) return !1 } return !0 }, containsPoint: function(e) { for (var t=this.planes, n=0; n < 6; n++) if (t[n].distanceToPoint(e) < 0) return !1; return !0 } }); var ou={ alphamap_fragment: "#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif" , alphamap_pars_fragment: "#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif" , alphatest_fragment: "#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif" , aomap_fragment: "#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\t#endif\n#endif" , aomap_pars_fragment: "#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif" , begin_vertex: "vec3 transformed = vec3( position );" , beginnormal_vertex: "vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif" , bsdfs: "vec2 integrateSpecularBRDF( const in float dotNV, const in float roughness ) {\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\treturn vec2( -1.04, 1.04 ) * a004 + r.zw;\n}\nfloat punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n#else\n\tif( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t}\n\treturn 1.0;\n#endif\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nvec3 F_Schlick_RoughnessDependent( const in vec3 F0, const in float dotNV, const in float roughness ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotNV - 6.98316 ) * dotNV );\n\tvec3 Fr = max( vec3( 1.0 - roughness ), F0 ) - F0;\n\treturn Fr * fresnel + F0;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + viewDir );\n\tfloat dotNL = saturate( dot( normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nvec3 BRDF_Specular_GGX_Environment( const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\treturn specularColor * brdf.x + brdf.y;\n}\nvoid BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tvec3 F = F_Schlick_RoughnessDependent( specularColor, dotNV, roughness );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\tvec3 FssEss = F * brdf.x + brdf.y;\n\tfloat Ess = brdf.x + brdf.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie(float roughness, float NoH) {\n\tfloat invAlpha = 1.0 / roughness;\n\tfloat cos2h = NoH * NoH;\n\tfloat sin2h = max(1.0 - cos2h, 0.0078125);\treturn (2.0 + invAlpha) * pow(sin2h, invAlpha * 0.5) / (2.0 * PI);\n}\nfloat V_Neubelt(float NoV, float NoL) {\n\treturn saturate(1.0 / (4.0 * (NoL + NoV - NoL * NoV)));\n}\nvec3 BRDF_Specular_Sheen( const in float roughness, const in vec3 L, const in GeometricContext geometry, vec3 specularColor ) {\n\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\tvec3 H = normalize( V + L );\n\tfloat dotNH = saturate( dot( N, H ) );\n\treturn specularColor * D_Charlie( roughness, dotNH ) * V_Neubelt( dot(N, V), dot(N, L) );\n}\n#endif" , bumpmap_pars_fragment: "#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\tfDet *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif" , clipping_planes_fragment: "#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vViewPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\tif ( clipped ) discard;\n\t#endif\n#endif" , clipping_planes_pars_fragment: "#if NUM_CLIPPING_PLANES > 0\n\t#if ! defined( STANDARD ) && ! defined( PHONG ) && ! defined( MATCAP )\n\t\tvarying vec3 vViewPosition;\n\t#endif\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif" , clipping_planes_pars_vertex: "#if NUM_CLIPPING_PLANES > 0 && ! defined( STANDARD ) && ! defined( PHONG ) && ! defined( MATCAP )\n\tvarying vec3 vViewPosition;\n#endif" , clipping_planes_vertex: "#if NUM_CLIPPING_PLANES > 0 && ! defined( STANDARD ) && ! defined( PHONG ) && ! defined( MATCAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif" , color_fragment: "#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif" , color_pars_fragment: "#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif" , color_pars_vertex: "#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif" , color_vertex: "#ifdef USE_COLOR\n\tvColor.xyz = color.xyz;\n#endif" , common: "#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI_HALF 1.5707963267949\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat max3( vec3 v ) { return max( max( v.x, v.y ), v.z ); }\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n return m[ 2 ][ 3 ] == - 1.0;\n}" , cube_uv_reflection_fragment: "#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_maxMipLevel 8.0\n#define cubeUV_minMipLevel 4.0\n#define cubeUV_maxTileSize 256.0\n#define cubeUV_minTileSize 16.0\nfloat getFace(vec3 direction) {\n vec3 absDirection = abs(direction);\n float face = -1.0;\n if (absDirection.x > absDirection.z) {\n if (absDirection.x > absDirection.y)\n face = direction.x > 0.0 ? 0.0 : 3.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n } else {\n if (absDirection.z > absDirection.y)\n face = direction.z > 0.0 ? 2.0 : 5.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n }\n return face;\n}\nvec2 getUV(vec3 direction, float face) {\n vec2 uv;\n if (face == 0.0) {\n uv = vec2(-direction.z, direction.y) / abs(direction.x);\n } else if (face == 1.0) {\n uv = vec2(direction.x, -direction.z) / abs(direction.y);\n } else if (face == 2.0) {\n uv = direction.xy / abs(direction.z);\n } else if (face == 3.0) {\n uv = vec2(direction.z, direction.y) / abs(direction.x);\n } else if (face == 4.0) {\n uv = direction.xz / abs(direction.y);\n } else {\n uv = vec2(-direction.x, direction.y) / abs(direction.z);\n }\n return 0.5 * (uv + 1.0);\n}\nvec3 bilinearCubeUV(sampler2D envMap, vec3 direction, float mipInt) {\n float face = getFace(direction);\n float filterInt = max(cubeUV_minMipLevel - mipInt, 0.0);\n mipInt = max(mipInt, cubeUV_minMipLevel);\n float faceSize = exp2(mipInt);\n float texelSize = 1.0 / (3.0 * cubeUV_maxTileSize);\n vec2 uv = getUV(direction, face) * (faceSize - 1.0);\n vec2 f = fract(uv);\n uv += 0.5 - f;\n if (face > 2.0) {\n uv.y += faceSize;\n face -= 3.0;\n }\n uv.x += face * faceSize;\n if(mipInt < cubeUV_maxMipLevel){\n uv.y += 2.0 * cubeUV_maxTileSize;\n }\n uv.y += filterInt * 2.0 * cubeUV_minTileSize;\n uv.x += 3.0 * max(0.0, cubeUV_maxTileSize - 2.0 * faceSize);\n uv *= texelSize;\n vec3 tl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.x += texelSize;\n vec3 tr = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.y += texelSize;\n vec3 br = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.x -= texelSize;\n vec3 bl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n vec3 tm = mix(tl, tr, f.x);\n vec3 bm = mix(bl, br, f.x);\n return mix(tm, bm, f.y);\n}\n#define r0 1.0\n#define v0 0.339\n#define m0 -2.0\n#define r1 0.8\n#define v1 0.276\n#define m1 -1.0\n#define r4 0.4\n#define v4 0.046\n#define m4 2.0\n#define r5 0.305\n#define v5 0.016\n#define m5 3.0\n#define r6 0.21\n#define v6 0.0038\n#define m6 4.0\nfloat roughnessToVariance(float roughness) {\n float variance = 0.0;\n if (roughness >= r1) {\n variance = (r0 - roughness) * (v1 - v0) / (r0 - r1) + v0;\n } else if (roughness >= r4) {\n variance = (r1 - roughness) * (v4 - v1) / (r1 - r4) + v1;\n } else if (roughness >= r5) {\n variance = (r4 - roughness) * (v5 - v4) / (r4 - r5) + v4;\n } else {\n float roughness2 = roughness * roughness;\n variance = 1.79 * roughness2 * roughness2;\n }\n return variance;\n}\nfloat varianceToRoughness(float variance) {\n float roughness = 0.0;\n if (variance >= v1) {\n roughness = (v0 - variance) * (r1 - r0) / (v0 - v1) + r0;\n } else if (variance >= v4) {\n roughness = (v1 - variance) * (r4 - r1) / (v1 - v4) + r1;\n } else if (variance >= v5) {\n roughness = (v4 - variance) * (r5 - r4) / (v4 - v5) + r4;\n } else {\n roughness = pow(0.559 * variance, 0.25); }\n return roughness;\n}\nfloat roughnessToMip(float roughness) {\n float mip = 0.0;\n if (roughness >= r1) {\n mip = (r0 - roughness) * (m1 - m0) / (r0 - r1) + m0;\n } else if (roughness >= r4) {\n mip = (r1 - roughness) * (m4 - m1) / (r1 - r4) + m1;\n } else if (roughness >= r5) {\n mip = (r4 - roughness) * (m5 - m4) / (r4 - r5) + m4;\n } else if (roughness >= r6) {\n mip = (r5 - roughness) * (m6 - m5) / (r5 - r6) + m5;\n } else {\n mip = -2.0 * log2(1.16 * roughness); }\n return mip;\n}\nvec4 textureCubeUV(sampler2D envMap, vec3 sampleDir, float roughness) {\n float mip = clamp(roughnessToMip(roughness), m0, cubeUV_maxMipLevel);\n float mipF = fract(mip);\n float mipInt = floor(mip);\n vec3 color0 = bilinearCubeUV(envMap, sampleDir, mipInt);\n if (mipF == 0.0) {\n return vec4(color0, 1.0);\n } else {\n vec3 color1 = bilinearCubeUV(envMap, sampleDir, mipInt + 1.0);\n return vec4(mix(color0, color1, mipF), 1.0);\n }\n}\n#endif" , defaultnormal_vertex: "vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n\ttransformedNormal = mat3( instanceMatrix ) * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif" , displacementmap_pars_vertex: "#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif" , displacementmap_vertex: "#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );\n#endif" , emissivemap_fragment: "#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif" , emissivemap_pars_fragment: "#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif" , encodings_fragment: "gl_FragColor = linearToOutputTexel( gl_FragColor );" , encodings_pars_fragment: "\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * value.a * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = min( floor( D ) / 255.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n\tvec3 Xp_Y_XYZp = cLogLuvM * value.rgb;\n\tXp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract( Le );\n\tvResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 );\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;\n\treturn vec4( max( vRGB, 0.0 ), 1.0 );\n}" , envmap_fragment: "#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\t\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 envColor = textureCubeUV( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ), 0.0 );\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\tvec2 sampleUV;\n\t\treflectVec = normalize( reflectVec );\n\t\tsampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\treflectVec = normalize( reflectVec );\n\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );\n\t\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifndef ENVMAP_TYPE_CUBE_UV\n\t\tenvColor = envMapTexelToLinear( envColor );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif" , envmap_common_pars_fragment: "#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform int maxMipLevel;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif" , envmap_pars_fragment: "#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif" , envmap_pars_vertex: "#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif" , envmap_physical_pars_fragment: "#if defined( USE_ENVMAP )\n\t#ifdef ENVMAP_MODE_REFRACTION\n\t\tuniform float refractionRatio;\n\t#endif\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, queryVec, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float roughness, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat sigma = PI * roughness * roughness / ( 1.0 + roughness );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar + log2( sigma );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t vec3 reflectVec = reflect( -viewDir, normal );\n\t\t reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t#else\n\t\t vec3 reflectVec = refract( -viewDir, normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( roughness, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, queryReflectVec, roughness );\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV;\n\t\t\tsampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\t\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif" , envmap_vertex: "#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) { \n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif" , fog_vertex: "#ifdef USE_FOG\n\tfogDepth = -mvPosition.z;\n#endif" , fog_pars_vertex: "#ifdef USE_FOG\n\tvarying float fogDepth;\n#endif" , fog_fragment: "#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * fogDepth * fogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif" , fog_pars_fragment: "#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float fogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif" , gradientmap_pars_fragment: "#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn texture2D( gradientMap, coord ).rgb;\n\t#else\n\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t#endif\n}" , lightmap_fragment: "#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\treflectedLight.indirectDiffuse += PI * lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n#endif" , lightmap_pars_fragment: "#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif" , lights_lambert_vertex: "vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n#endif" , lights_pars_begin: "uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in GeometricContext geometry ) {\n\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t\tfloat shadowCameraNear;\n\t\tfloat shadowCameraFar;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif" , lights_toon_fragment: "ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;" , lights_toon_pars_fragment: "varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct ToonMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon\n#define Material_LightProbeLOD( material )\t(0)" , lights_phong_fragment: "BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;" , lights_phong_pars_fragment: "varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)" , lights_physical_fragment: "PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.specularRoughness = max( roughnessFactor, 0.0525 );material.specularRoughness += geometryRoughness;\nmaterial.specularRoughness = min( material.specularRoughness, 1.0 );\n#ifdef REFLECTIVITY\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#endif\n#ifdef CLEARCOAT\n\tmaterial.clearcoat = saturate( clearcoat );\tmaterial.clearcoatRoughness = max( clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheen;\n#endif" , lights_physical_pars_fragment: "struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n#ifdef CLEARCOAT\n\tfloat clearcoat;\n\tfloat clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tvec3 sheenColor;\n#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearcoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNL = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = ccDotNL * directLight.color;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tccIrradiance *= PI;\n\t\t#endif\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t\treflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_Sheen(\n\t\t\tmaterial.specularRoughness,\n\t\t\tdirectLight.direction,\n\t\t\tgeometry,\n\t\t\tmaterial.sheenColor\n\t\t);\n\t#else\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness);\n\t#endif\n\treflectedLight.directDiffuse += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNV = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular += clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t\tfloat ccDotNL = ccDotNV;\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\tfloat clearcoatInv = 1.0 - clearcoatDHR;\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tBRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\treflectedLight.indirectSpecular += clearcoatInv * radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}" , lights_fragment_begin: "\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tdirectLight.color *= all( bvec3( pointLight.shadow, directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tdirectLight.color *= all( bvec3( spotLight.shadow, directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectLight.color *= all( bvec3( directionalLight.shadow, directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif" , lights_fragment_maps: "#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\tvec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.normal, material.specularRoughness, maxMipLevel );\n\t#ifdef CLEARCOAT\n\t\tclearcoatRadiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness, maxMipLevel );\n\t#endif\n#endif" , lights_fragment_end: "#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif" , logdepthbuf_fragment: "#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif" , logdepthbuf_pars_fragment: "#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif" , logdepthbuf_pars_vertex: "#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif" , logdepthbuf_vertex: "#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif" , map_fragment: "#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif" , map_pars_fragment: "#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif" , map_particle_fragment: "#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n#endif\n#ifdef USE_MAP\n\tvec4 mapTexel = texture2D( map, uv );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif" , map_particle_pars_fragment: "#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tuniform mat3 uvTransform;\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif" , metalnessmap_fragment: "float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif" , metalnessmap_pars_fragment: "#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif" , morphnormal_vertex: "#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n#endif" , morphtarget_pars_vertex: "#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifndef USE_MORPHNORMALS\n\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif" , morphtarget_vertex: "#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t#endif\n#endif" , normal_fragment_begin: "#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t\tbitangent = bitangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t#endif\n\t\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal = normal;" , normal_fragment_maps: "#ifdef OBJECTSPACE_NORMALMAP\n\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\t#ifdef USE_TANGENT\n\t\tnormal = normalize( vTBN * mapN );\n\t#else\n\t\tnormal = perturbNormal2Arb( -vViewPosition, normal, mapN );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif" , normalmap_pars_fragment: "#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tfloat scale = sign( st1.t * st0.s - st0.t * st1.s );\n\t\tvec3 S = normalize( ( q0 * st1.t - q1 * st0.t ) * scale );\n\t\tvec3 T = normalize( ( - q0 * st1.s + q1 * st0.s ) * scale );\n\t\tvec3 N = normalize( surf_norm );\n\t\tmat3 tsn = mat3( S, T, N );\n\t\tmapN.xy *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\treturn normalize( tsn * mapN );\n\t}\n#endif" , clearcoat_normal_fragment_begin: "#ifdef CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif" , clearcoat_normal_fragment_maps: "#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\t#ifdef USE_TANGENT\n\t\tclearcoatNormal = normalize( vTBN * clearcoatMapN );\n\t#else\n\t\tclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN );\n\t#endif\n#endif" , clearcoat_normalmap_pars_fragment: "#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif" , packing: "vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ));\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w);\n}\nvec2 unpack2HalfToRGBA( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}" , premultiplied_alpha_fragment: "#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif" , project_vertex: "vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;" , dithering_fragment: "#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif" , dithering_pars_fragment: "#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif" , roughnessmap_fragment: "float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif" , roughnessmap_pars_fragment: "#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif" , shadowmap_pars_fragment: "#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpack2HalfToRGBA( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat texture2DShadowLerp( sampler2D depths, vec2 size, vec2 uv, float compare ) {\n\t\tconst vec2 offset = vec2( 0.0, 1.0 );\n\t\tvec2 texelSize = vec2( 1.0 ) / size;\n\t\tvec2 centroidUV = ( floor( uv * size - 0.5 ) + 0.5 ) * texelSize;\n\t\tfloat lb = texture2DCompare( depths, centroidUV + texelSize * offset.xx, compare );\n\t\tfloat lt = texture2DCompare( depths, centroidUV + texelSize * offset.xy, compare );\n\t\tfloat rb = texture2DCompare( depths, centroidUV + texelSize * offset.yx, compare );\n\t\tfloat rt = texture2DCompare( depths, centroidUV + texelSize * offset.yy, compare );\n\t\tvec2 f = fract( uv * size + 0.5 );\n\t\tfloat a = mix( lb, lt, f.y );\n\t\tfloat b = mix( rb, rt, f.y );\n\t\tfloat c = mix( a, b, f.x );\n\t\treturn c;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tshadow = (\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif" , shadowmap_pars_vertex: "#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif" , shadowmap_vertex: "#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n#endif" , shadowmask_pars_fragment: "float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLight directionalLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tshadow *= all( bvec2( directionalLight.shadow, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLight spotLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tshadow *= all( bvec2( spotLight.shadow, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLight pointLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tshadow *= all( bvec2( pointLight.shadow, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#endif\n\t#endif\n\treturn shadow;\n}" , skinbase_vertex: "#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif" , skinning_pars_vertex: "#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform highp sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif" , skinning_vertex: "#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif" , skinnormal_vertex: "#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif" , specularmap_fragment: "float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif" , specularmap_pars_fragment: "#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif" , tonemapping_fragment: "#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif" , tonemapping_pars_fragment: "#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( ( color * ( 2.51 * color + 0.03 ) ) / ( color * ( 2.43 * color + 0.59 ) + 0.14 ) );\n}" , uv_pars_fragment: "#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\tvarying vec2 vUv;\n#endif" , uv_pars_vertex: "#ifdef USE_UV\n\t#ifdef UVS_VERTEX_ONLY\n\t\tvec2 vUv;\n\t#else\n\t\tvarying vec2 vUv;\n\t#endif\n\tuniform mat3 uvTransform;\n#endif" , uv_vertex: "#ifdef USE_UV\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif" , uv2_pars_fragment: "#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif" , uv2_pars_vertex: "#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n\tuniform mat3 uv2Transform;\n#endif" , uv2_vertex: "#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n#endif" , worldpos_vertex: "#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif" , background_frag: "uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include \n\t#include \n}" , background_vert: "varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}" , cube_frag: "#include \nuniform float opacity;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvec3 vReflect = vWorldDirection;\n\t#include \n\tgl_FragColor = envColor;\n\tgl_FragColor.a *= opacity;\n\t#include \n\t#include \n}" , cube_vert: "varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\n}" , depth_frag: "#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - gl_FragCoord.z ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( gl_FragCoord.z );\n\t#endif\n}" , depth_vert: "#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}" , distanceRGBA_frag: "#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main () {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include \n\t#include \n\t#include \n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}" , distanceRGBA_vert: "#define DISTANCE\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvWorldPosition = worldPosition.xyz;\n}" , equirect_frag: "uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV;\n\tsampleUV.y = asin( clamp( direction.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n\tvec4 texColor = texture2D( tEquirect, sampleUV );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include \n\t#include \n}" , equirect_vert: "varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}" , linedashed_frag: "uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}" , linedashed_vert: "uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvLineDistance = scale * lineDistance;\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include \n\t#include \n\t#include \n}" , meshbasic_frag: "uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\treflectedLight.indirectDiffuse += lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include \n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}" , meshbasic_vert: "#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef USE_ENVMAP\n\t#include \n\t#include \n\t#include \n\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}" , meshlambert_frag: "uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\treflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n\t#else\n\t\treflectedLight.indirectDiffuse += vIndirectFront;\n\t#endif\n\t#include \n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}" , meshlambert_vert: "#define LAMBERT\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}" , meshmatcap_frag: "#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t\tmatcapColor = matcapTexelToLinear( matcapColor );\n\t#else\n\t\tvec4 matcapColor = vec4( 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}" , meshmatcap_vert: "#define MATCAP\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include